dopesong/slim-whoops
最新稳定版本:2.3.0
Composer 安装命令:
composer require dopesong/slim-whoops
包简介
Slim Framework 3 error handler built on top of the Whoops error handler
README 文档
README
Slim Framework 3 error handler built on top of Whoops Error Handler
Installing
Use Composer to install Whoops into your project:
composer require dopesong/slim-whoops Requirements
- PHP >=5.6.0
- Whoops ^2.0
Usage With Slim 3
use Dopesong\Slim\Error\Whoops as WhoopsError; include "vendor/autoload.php"; $app = new Slim\App(); $container = $app->getContainer(); $container['phpErrorHandler'] = $container['errorHandler'] = function($c) { return new WhoopsError(); }; $app->run();
Additional handlers
Custom handlers can be added to execute additional tasks. For example, you might want to log the error like so:
include "vendor/autoload.php"; use Whoops\Handler\Handler; use Dopesong\Slim\Error\Whoops as WhoopsError; $app = new Slim\App(); $container = $app->getContainer(); $container['phpErrorHandler'] = $container['errorHandler'] = function ($container) { $logger = $container['logger']; $whoopsHandler = new WhoopsError(); $whoopsHandler->pushHandler( function ($exception) use ($logger) { /** @var \Exception $exception */ $logger->error($exception->getMessage(), ['exception' => $exception]); return Handler::DONE; } ); return $whoopsHandler; };
统计信息
- 总下载量: 46.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04