stratify / error-handler-module
Error handler module for Stratify
0.5.0
2017-08-05 19:33 UTC
Requires
- filp/whoops: ^2.0
- php-di/php-di: ^6.0.0-alpha4
- psr/container: ^1.0
- psr/http-message: ^1.0
- psr/log: ^1.0
- stratify/http: ~0.5.0
Requires (Dev)
- phpunit/phpunit: ^5.2
- zendframework/zend-diactoros: ^1.3
README
Installation
-
- Install the package:
composer require stratify/error-handler-module
-
- Enable the module:
$app = new Application([ 'stratify/error-handler-module', ]);
-
- Use the HTTP middleware:
$http = pipe([ ErrorHandlerMiddleware::class, // ... ]); $app->http($http)->run();
The HTTP middleware catches all exceptions happening in sub-middlewares and displays an error page. Because of that, you probably want that middleware to run before all others middlewares.
The default behavior is to show a very simple error page: Server error
(status code 500).
In dev
environment the error page will be much more detailed thanks to the Whoops library. For security reasons (not exposing any sensitive information), this page only displays if you configure the application to run in dev
environment:
$app = new Application($modules, 'dev');