silexandfriends/web-profiler

Silex 的 WebProfiler

v2.1 2021-03-12 17:13 UTC

README

警告: Silex 仅处于维护模式。生命周期截止到 2018 年 6 月。更多信息请参阅 Symfony 的博客.

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

注意

如果你使用的是 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());

如果你使用 FormServiceProvider,则 WebProfilerServiceProvider 将检测到并启用相应的面板。

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

如果你使用 MonologServiceProvider 进行日志记录,你还必须在 Composer 依赖项中添加 symfony/monolog-bridge 以在 Profiler 中获取日志。

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

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