luismayta/zfdebug

dev-master 2014-05-23 00:28 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:39:24 UTC


README

ZFDebug 是一个适用于 PHP5 的 Zend Framework 插件,可以在每个页面的底部小栏中显示有用的调试信息。

耗时、内存使用和数据库查询次数一目了然。此外,还包括文件列表、可用视图变量的列表以及所有查询的完整 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);
}

随着 github 迁移的进展,将提供更多文档。