alfatron-tr/zfdebug

ZFDebug 的分支,用于与 Fokus 媒体资产管理软件一起使用。

1.7.1 2020-09-15 12:23 UTC

This package is auto-updated.

Last update: 2024-09-22 23:30:30 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