dongww / silex-debugbar
Silex 的 php-debugbar 提供者。
v0.4.0
2016-12-15 06:46 UTC
Requires
- maximebf/debugbar: 1.*
- silex/silex: 2.*
Suggests
- doctrine/dbal: 2.*
This package is not auto-updated.
Last update: 2024-09-14 17:16:16 UTC
README
Silex 2.* 的 php-debugbar 提供者。
##安装
composer require dongww/silex-debugbar *
##使用方法
$app->register(new Dongww\Silex\Provider\DebugBarServiceProvider());
JS 和 CSS 文件将自动从 vendor 目录加载。
如果 vendor 目录或 debugBar 的 Resources 目录已存在于公共目录中,可以将选项 'debug_bar.auto_res' 设置为 false
,并将选项 'debug_bar.path' 设置为资源目录。这将加快加载速度。
$app->register(new Dongww\Silex\Provider\DebugBarServiceProvider(), [ 'debug_bar.auto_res' => false, //Optional, default is true 'debug_bar.path' => '/debugbar', //Optional, default is null. ]);
##示例
<?php use Silex\Application; use Dongww\Silex\Provider\DebugBarServiceProvider; require_once __DIR__ . '/../vendor/autoload.php'; $app = new Application(); $app['debug'] = true; if ($app['debug']) { $app->register(new DebugBarServiceProvider(), [ // 'debug_bar.auto_res' => false, //Optional, default is true // 'debug_bar.path' => '/debugbar', //Optional, default is null. ]); } $app->get('/', function (Application $app) { $app['debug_bar']['messages']->addMessage("Hello DebugBar!"); $app['debug_bar']['messages']->addMessage([ 'a' => 1, 'b' => 2, 'c' => 3, ]); return '<body><h1>This is an example for silex_debugbar provider.</h1></body>'; }); $app->run();
##Doctrine DBAL 日志
如果您使用 Doctrine 提供者,sql 日志将自动捕获并显示在 debugBar 中。