franzl / whoops-middleware
Whoops的PSR-15兼容中间件,用于优雅的错误处理
2.0.0
2021-01-03 01:30 UTC
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
这是一个PSR-15兼容的中间件,用于Whoops,PHP中出色的优雅错误处理器。
安装
您可以使用Composer安装此库
composer require franzl/whoops-middleware
用法
假设您正在使用PSR-15兼容的中间件分发器(例如zend-stratigility、Relay或broker),您只需将中间件类添加到您的管道/经纪人/分发器...
这可能会看起来像这样
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)