Skip to content
Zend Expressive Monolog ErrorHandler
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
composer.json
composer.lock
phpcs.xml.dist
phpstan.installer.neon

README.md

Zend Expressive Monolog ErrorHandler

Latest Stable Version Total Downloads Monthly Downloads Software License

This library enables Monolog as ErrorHandler in Zend Expressive.

Currently, there are 2 handlers supported (more will be added if needed):

Install

composer require geo6/zend-expressive-monolog

Configuration

Create a monolog.global.php file in your config directory:

<?php

declare(strict_types=1);

return [
    // StreamHandler
    'stream' => [
        'path' => 'data/log/myapp.log',
    ],
    // SentryHanlder
    'sentry' => [
        'dsn' => 'https://xxxxx@sentry.io/12345',
    ],
];

Usage

To enable it, you just have to add Geo6\Expressive\Monolog\ConfigProvider::class to your main configuration (usually config/config.php):

...

$aggregator = new ConfigAggregator([
+     Geo6\Expressive\Monolog\ConfigProvider::class,

    ...
], $cacheConfig['config_cache_path']);

...

The Monolog ErrorHandler will be active only in "production mode" (when $config['debug] is false).
To switch to "production mode", you can use composer run development-disable.

You can’t perform that action at this time.