filisko / debugbar-redbean
Debugbar 的 RedBeanPHP 收集器
1.0
2016-08-27 10:54 UTC
Requires
- maximebf/debugbar: ^1.11
This package is auto-updated.
Last update: 2024-08-29 02:27:18 UTC
README
结果
安装和配置
通过 composer 安装
composer require filisko/debugbar-redbean`
为了使此功能正常工作,您必须启用 RedBean 的调试模式以记录您的查询。您可以简单地使用 RedBean 的外观 debug() 方法。
如何使用
要使用此日志记录器与任何应用程序,您基本上可以这样做
R::setup('mysql:host=hostname;dbname=db', 'username', 'password'); /* Possible log modes: ------------------- 0 Log and write to STDOUT classic style (default) 1 Log only, class style 2 Log and write to STDOUT fancy style 3 Log only, fancy style (it works nicely with this one) */ R::debug(true, 3); // ... your queries here ... // Get RedBean's Logger $logger = R::getLogger(); $debugbar = new \DebugBar\StandardDebugBar(); $debugbar->addCollector(new \Filisko\DebugBar\DataCollector\RedBeanCollector($logger));
如果您意识到 RedBean 在您的 SQL 查询末尾添加了一些像 '--keep-cache' 这样的内容,用于内部缓存目的,并且您想从日志记录器中隐藏这部分,您可以使用静态标志简单地禁用它
\Filisko\DebugBar\DataCollector\RedBeanCollector::$showKeepCache = false; // That's all!
建议、想法等。
如果您有任何建议、想法或其他内容,请给我发电子邮件 (filisfutsarov[at]gmail.com) 或在此存储库中创建一个问题。