quietasice/slim-debugbar
Composer 安装命令:
composer require quietasice/slim-debugbar
包简介
关键字:
README 文档
README
This middleware append PHP Debug Bar to Slim response.
Inspired by Laravel 4 DebugBar
Custom Collectors
- SlimEnvCollector (collect slim mode and version)
- SlimViewCollector (collect view variables)
- SlimRouteCollector (collect matched route information)
- SlimResponseCollector (collect response headers and cookies)
DebugBar Default Collectors
- SlimCollector
- PhpInfoCollector
- ConfigCollector
- RequestDataCollector
- TimeDataCollector
- MemoryCollector
Install
Require this package in your composer.json
"yusukezzz/slim-debugbar": "1.*"
example
<?php require '/path/to/vendor/autoload.php'; $config = []; // if you want to capture ajax requests, set instance of StorageInterface implemented. // $config['debugbar.storage'] = new \DebugBar\Storage\FileStorage('/path/to/storage'); $slim = new \Slim\Slim($config); $debugbar = new \Slim\Middleware\DebugBar(); // you can add custom collectors // $debugbar->addCollector(new MyCustomCollector()); // or use custom debugbar // $debugbar->setDebugBar(new MyCustomDebugBar()); $slim->add($debugbar); $slim->get('/', function() { echo 'Hello world!'; }); $slim->run();
Notice
- Please use real httpd (apache, nginx etc...)
- PHP builtin server does not supported.
- Available storage for ajax capturing
- Filesystem, PDO and Redis
- for more information, please refer to the official document.
- Redirection data stack
- support PHP native session only (session_start() required)
- if you want to use your own session manager, you should implement DebugBar\HttpDriverInterface.
- Reserved route for DebugBar
- /_debugbar/fonts/:file
- for fontawesome files
- /_debugbar/resources/:file
- for css, javascript
- /_debugbar/openhandler
- for previous sets of collected data
- /_debugbar/fonts/:file
Custom Session Manager example
<?php require '/path/to/vendor/autoload.php'; class MyHttpDriver implements \DebugBar\HttpDriverInterface { protected $session; protected $response; public function __construct(YourSessionManager $session, \Slim\Http\Response $response) { $this->session = $session; $this->response = $response; } public function setHeaders(array $headers) { foreach ($headers as $key => $val) { $this->response->header($key, $val); } } public function isSessionStarted() { return $this->session->isStarted(); } // You should implement other methods too } $slim = new \Slim\Slim(); $slim->container->singleton('session', function() { return new YourSessionManager(); }); $driver = new MyHttpDriver($slim->session, $slim->response); $debugbar = new \Slim\Middleware\DebugBar($driver); $slim->add($debugbar); $slim->get('/', function() { echo 'Hello world!'; }); $slim->get('/redirect', function() use ($slim) { $slim->response->redirect('/'); }); $slim->run();
Q&A
- Q. Errors in the browser's console:
Resource interpreted as Font but transferred with MIME type text/html- A. Please read this solution
License
MIT
quietasice/slim-debugbar 适用场景与选型建议
quietasice/slim-debugbar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.43k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「middleware」 「debugbar」 「slim」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 quietasice/slim-debugbar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quietasice/slim-debugbar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 quietasice/slim-debugbar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Secure session middleware for Slim 3 framework
A fork of runcmf/runtracy
DebugBar integration for Winter CMS.
Monolog bridge for PHP Debugbar
Addon for catching e-mails in Nette FW to filesystem and showing it in the Debug Bar.
统计信息
- 总下载量: 5.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-26