dereuromark/cakephp-whoops
Composer 安装命令:
composer require dereuromark/cakephp-whoops
包简介
Whoops error handler for CakePHP
README 文档
README
Seamlessly integrate Whoops into CakePHP applications.
Demo-Video: Linux Mint + Firefox
This branch is for use with CakePHP 5.0+. For details see version map.
Install
Using Composer:
composer require dereuromark/cakephp-whoops
As this package only offers a Whoops handler for CakePHP, there is no need to
enable it (no ->addPlugin() call). You only need to configure the renderer classes inside your config/app.php or config/app_local.php:
'Error' => [ 'exceptionRenderer' => \CakephpWhoops\Error\WhoopsExceptionRenderer::class, 'errorRenderer' => \CakephpWhoops\Error\WhoopsErrorRenderer::class ],
When using new Application.php and Middleware approach, you also need to adjust that:
// Replace ErrorHandlerMiddleware with ->add(new \CakephpWhoops\Error\Middleware\WhoopsHandlerMiddleware(Configure::read('Error')))
Debug Mode
An important note: This plugin is installed as require dependency, but even so it is more used as require-dev one. If the debug mode is off, it will completely ignore the Whoops handler, as without debug mode there is no exception to render. It will then display the public error message and only log internally.
So make sure you enable debug (locally) for checking out this package. For each error and exception you should then see the improved whoops handler output on your screen.
Editor
Opening the file in the editor via click in the browser is supported for most major IDEs.
It uses phpstorm:// URLs which can open the file through a command line call and directly jump to the right line.
Set your config as
'Whoops' => [ 'editor' => true, ],
To enable it.
If you are using a VM, e.g. CakeBox, you will also need the path mapping:
'userBasePath' => 'C:\wamp\www\cakebox\Apps\my-app.local', 'serverBasePath' => '/home/vagrant/Apps/my-app.local',
If you would like to override the default URL handler (phpstorm://) you could do so by setting the ideLinkPattern option to a custom URL handler:
- PhpStorm:
phpstorm://open?file=%s&line=%s - Visual Studio Code:
vscode://file/%s:%s
See the Wiki for more details on different OS and Browsers.
Strictness
As a bonus the error handler is a bit more strict here for development. It will not just ignore notices and other errors, but display them the same way in order to fix them with the same ease and speed as exceptions.
Usually, when a variable is not found, all following code can also not yield any useful results, as the example below shows. Better to code cleaner in the first place and to avoid any warning or notice to be thrown in the first place.
Before:
After:
dereuromark/cakephp-whoops 适用场景与选型建议
dereuromark/cakephp-whoops 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 95.62k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2018 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「error handler」 「cakephp」 「whoops」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dereuromark/cakephp-whoops 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dereuromark/cakephp-whoops 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dereuromark/cakephp-whoops 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lazy loading for middleware and request handlers
CakePHP 4.x AdminLTE Theme.
Set Links with a specific language parameter
Bootstraps errors and handles them via reporters and renderers
Email Toolkit Plugin for CakePHP
PHP Error Handler module that captures and displays all throwable errors in a given format, making debugging easier and more efficient
统计信息
- 总下载量: 95.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-19

