clippings/web-profiler

Silex 的 WebProfiler

2.1.0-beta.2 2020-03-17 14:35 UTC

README

警告:Silex 仅处于维护模式。生命周期的结束时间定于 2018 年 6 月。在 Symfony 的博客上了解更多信息

Silex Web Profiler 服务提供程序允许你在 Silex 2.x 应用程序中使用出色的 Symfony Web 调试工具栏和 Symfony 分析器。

注意

如果你使用的是 1.x 版本的 Silex,请阅读特定文档

要安装此库,运行以下命令并获取最新版本

composer require 'silex/web-profiler:^2.0'

并在你的应用程序中启用它

use Silex\Provider;

$app->register(new Provider\WebProfilerServiceProvider(), array(
    'profiler.cache_dir' => __DIR__.'/../cache/profiler',
    'profiler.mount_prefix' => '/_profiler', // this is the default
));

提供程序依赖于 ServiceControllerServiceProviderTwigServiceProviderHttpFragmentServiceProvider,因此如果你还没有这样做,你也需要启用这些服务提供程序。

$app->register(new Provider\HttpFragmentServiceProvider());
$app->register(new Provider\ServiceControllerServiceProvider());
$app->register(new Provider\TwigServiceProvider());

如果你使用 FormServiceProviderWebProfilerServiceProvider 将检测到并启用相应的面板。

确保在 WebProfilerServiceProvider 之前注册所有其他必需或使用的服务提供程序

如果你使用 MonologServiceProvider 记录日志,你必须还将 symfony/monolog-bridge 添加为 Composer 依赖项,以在分析器中获得日志。

如果你使用 VarDumperServiceProvider,你必须将 symfony/debug-bundle 添加为 Composer 依赖项,以在工具栏和分析器中显示 VarDumper 输出。

如果你使用 symfony/security,你必须将 symfony/security-bundle 添加为 Composer 依赖项,以在工具栏和分析器中显示与安全相关的信息。