ninja-anija / zfdebug

ZFDebug 是一个为 PHP5 的 Zend Framework 插件,它提供了一个底部小栏来显示有用的调试信息。

1.6.3 2016-07-29 07:56 UTC

This package is not auto-updated.

Last update: 2024-09-26 19:08:22 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);
}

使用 Composer

您现在可以使用依赖管理工具 Composer 安装 ZFDebug。

要使用 Composer 安装 ZFDebug,请将以下内容添加到您的项目 composer.json 文件中的 require 列表:

"require": {
    "ninja-anija/zfdebug": "1.*"
},

运行安装命令以解析和下载依赖项。

php composer.phar install

随着 github 的迁移进展,将进一步提供文档。