franzl / whoops-middleware
PSR-15 compatible middleware for Whoops, the pretty error handler
Installs: 1 535 297
Dependents: 21
Suggesters: 2
Security: 0
Stars: 28
Watchers: 3
Forks: 10
Open Issues: 0
Requires
- php: ^7.2 || ^8.0
- filp/whoops: ^1.1 || ^2.0
- middlewares/utils: ^3.0
Requires (Dev)
- laminas/laminas-diactoros: ^1.1.0 || ^2.0
- phpunit/phpunit: ^8.0
- psr/http-server-middleware: ^1.0
Suggests
- psr/http-server-middleware: In case you want to use PSR 15 middleware
README
A PSR-15 compatible middleware for Whoops, the fantastic pretty error handler for PHP.
Installation
You can install the library using Composer:
composer require franzl/whoops-middleware
Usage
Assuming you are using a PSR-15 compatible middleware dispatcher (such as zend-stratigility, Relay, or broker), all you need to do is add the middleware class to your pipeline / broker / dispatcher ...
This might look as follows:
Stratigility
$pipe->pipe(new \Franzl\Middleware\Whoops\WhoopsMiddleware)
Relay
$queue = []; // ... $queue[] = new \Franzl\Middleware\Whoops\WhoopsMiddleware; $relay = new Relay($queue);
broker
$broker->always(\Franzl\Middleware\Whoops\WhoopsMiddleware::class)