studiomax / zfdebug
ZFDebug 是一个针对 PHP5 的 Zend 框架插件,它提供了一个小工具条,显示在每个页面底部的有用调试信息。
1.6.4
2017-09-08 10:16 UTC
Requires
This package is auto-updated.
Last update: 2024-09-11 14:00:52 UTC
README
ZFDebug 是一个针对 PHP5 的 Zend 框架插件,它提供了一个小工具条,显示在每个页面底部的有用调试信息。
时间消耗、内存使用和数据库查询次数一目了然。此外,还包括文件列表、可用的视图变量和所有查询的完整 SQL 命令。
目前可用的插件有
- 缓存:关于 Zend_Cache、APC 和 Zend OPcache(适用于 PHP 5.5)的信息。
- 数据库:Zend_Db 的完整 SQL 查询列表及其时间。
- 异常:错误和异常处理。
- 文件:包含的文件数量和大小,以及完整的文件列表。
- HTML:外部样式表和 JavaScript 的数量。链接到 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": {
"jokkedk/zfdebug": "1.6.2"
},
运行安装命令以解决和下载依赖项
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