如何在 symfony 4 中启用分析器

How to enable profiler in symfony 4

已解决:

我重新安装一遍,现在里面包含了web_profiler.yalm。感谢大家。


原问题是:

我刚开始学习 Symfony,所以我在 KnpUniversity 下载了免费视频以开始学习。当我到达视频 "Web Debug Toolbar & the Profiler!" 时,我执行了下一个命令:

> composer require profiler --dev

安装成功。

然后,当我在浏览器中打开我的应用程序时,“(...)底部光滑的黑色条...”没有出现。

我在某处读到可能是因为我没有安装 symfony/debug 但看看我的 composer.json:

"require-dev": {
        "sensiolabs/security-checker": "^4.1",
        "symfony/debug": "^4.0",
        "symfony/dotenv": "^4.0",
        "symfony/profiler-pack": "^1.0",
        "symfony/web-server-bundle": "^4.0"
    },

所以我安装了它。

我执行了以下命令,它为我的项目提供了探查器配置:

> php bin/console debug:config web_profiler                   

Current configuration for extension with alias "web_profiler" 
============================================================= 

web_profiler:                                                 
    toolbar: false                                            
    intercept_redirects: false                                
    excluded_ajax_paths: '^/((index|app(_[\w]+)?)\.php/)?_wdt'

如上所示,工具栏设置为 false,如何激活它?如何显示分析器栏?

我正在使用:

提前致谢。

解法:

我创建了一个新项目并且它工作了,当 composer 下载包时它似乎是一个错误。

我刚刚安装了新项目,我可以确认探查器和工具栏是默认启用的。配置在config/packages/dev/web_profiler.yaml中找到,配置如下:

web_profiler:
    toolbar: true
    intercept_redirects: false

framework:
    profiler: { only_exceptions: false }

请注意,您必须附加 web_profiler 条路线。

在:

config/routes/dev/web_profiler.yaml

web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt

web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler