nox a0fd572948 | ||
---|---|---|
.. | ||
src | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
composer.json |
README.md
middlewares/whoops
Middleware to use Whoops as error handler.
Requirements
- PHP >= 5.6
- A PSR-7 http mesage implementation (Diactoros, Guzzle, Slim, etc...)
- A PSR-15 middleware dispatcher (Middleman, etc...)
Installation
This package is installable and autoloadable via Composer as middlewares/whoops.
composer require middlewares/whoops
Example
$dispatcher = new Dispatcher([
new Middlewares\Whoops()
]);
$response = $dispatcher->dispatch(new ServerRequest());
Options
__construct(Whoops\Run $whoops = null, Whoops\Util\SystemFacade $system = null)
Allows to provide a custom Whoops\Run
instance. If it's not defined, creates an instance automatically. You can provide also the SystemFacade
used by the Run
instance, in order to implement a special behaviour with fatal errors.
catchErrors(true)
To catch not only throwable exceptions, but also php errors. This makes whoops to be registered temporary in order to capture the errors using set_error_handler
. It's enabled by default so, to disable it you have to use ->catchErrors(false)
;
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.