rubao / zfdebug
对ZFDebug进行了修改的分支。
1.7.1
2020-04-16 15:14 UTC
Requires
- zendframework/zendframework1: 1.12.20
Replaces
- jokkedk/zfdebug: >=1.7
README
ZFDebug是PHP5的Zend Framework插件,在每一页的底部小栏中提供有用的调试信息。
显示花费的时间、内存使用量和数据库查询次数。此外,还包括文件列表、可用视图变量和所有查询的完整SQL命令,分别显示在不同的面板中。
目前可用的插件有
- 缓存:关于Zend_Cache、APC和Zend OPcache(适用于PHP 5.5)的信息。
- 数据库:从Zend_Db的全SQL查询列表及其时间。
- 异常:错误和异常的处理。
- 文件:包含文件的数目和大小,完整列表。
- HTML:外部样式表和javascripts的数量。链接到W3C进行验证。用于自定义内存测量。
- 日志:当前请求的时间信息、动作控制器中花费的时间和自定义计时器。还包括请求的平均、最小和最大时间。
- 变量:视图变量、请求信息和
$_COOKIE、$_POST和$_SESSION的内容。
安装与使用
要安装,将'ZFDebug'文件夹放置在您的库路径中,位于Zend文件夹旁边。然后向您的引导文件(在ZF1.8+中)添加以下方法:
protected function _initZFDebug()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFDebug');
$options = array(
'plugins' => array('Variables',
'Database' => array('adapter' => $db),
'File' => array('basePath' => '/path/to/project'),
'Cache' => array('backend' => $cache->getBackend()),
'Exception')
);
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');
$frontController->registerPlugin($debug);
}
或者您可以在引导文件中这样初始化,如果您的配置文件中设置了zfdebug配置(请参阅下面的选项):
$debug = new ZFDebug_Controller_Plugin_Debug($this->getOption('zfdebug'));
使用Composer
您现在可以使用Composer依赖管理工具安装ZFDebug。
要在Composer中使用ZFDebug,将以下内容添加到项目composer.json文件中的require列表中
"require": {
"rubao/zfdebug": "1.7.1"
},
运行安装命令以解析和下载依赖项
php composer.phar install
随着github迁移的进展,将提供更多文档。
选项
zfdebug.enabled = true
; Include variables plugin
zfdebug.plugins.Variables = null
; Include database without explain
zfdebug.plugins.Database.explain = false
; Generate backtrace for queries
zfdebug.plugins.Database.backtrace = true
; Log exceptions
zfdebug.plugins.Exception = null
; Include file list filtered
zfdebug.plugins.File.base_path = APPLICATION_PATH "/../"
zfdebug.plugins.File.library = Regnskab