8

Solved:

I re-install it all over again and now it contains the web_profiler.yalm inside. Thanks to all.


The original question was:

I´m just starting to learn Symfony so I downloaded the free videos at KnpUniversity to get started. When I reached the video "Web Debug Toolbar & the Profiler!" I excecuted the next command:

> composer require profiler --dev

it installed OK.

Then, when I opened my app in the browser the "(...)slick black bar at the bottom..." didn't show up.

I read somewhere that maybe is due to I haven't installed symfony/debug but look at my 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"
    },

so I have it installed.

I excecuted the following command which give me the profiler configuration in my project:

> 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'

As you see above, the toolbar is set to false, How can I activate it? or How can I get the profiler bar showed up?

I'm using:

  • Composer version 1.6.5,
  • Symfony 4.1.1 and
  • PHP 7.2.7

Thanks in advance.

Solution:

I created a new project and it worked, it appears to be an error when composer was downloading the packages.

Nestor
  • 519
  • 1
  • 7
  • 21
  • Check in your `config/packages/dev` directory – Iwan Wijaya Jul 04 '18 at 15:02
  • There is only a file named routing.yaml with this inside: framework: router: strict_requirements: true – Nestor Jul 04 '18 at 15:04
  • You need to send a complete html page to get the profile bar to show up. I suspect you just have a simple return new Response('Hello'); – Cerad Jul 04 '18 at 15:05
  • In the file: config/packages/dev/web_profiler.yaml change toolbar: false to toolbar: true – Jeroen Jul 04 '18 at 15:06
  • And disregard all the comments about your config. Unless you intentionally went in and made changes, the default config will work just fine. – Cerad Jul 04 '18 at 15:07
  • @Cerad I somehow suppossed that I would need that and I made and extends of base.html.twig and return it – Nestor Jul 04 '18 at 15:08
  • The output of your php bin/console debug:config web_profiler toolbar: false that should be true – Jeroen Jul 04 '18 at 15:10
  • I don't have that file "web_profiler.yaml" anywhere @Jeroen – Nestor Jul 04 '18 at 15:10
  • you can create one in the directory i mentioned, also check if the config web_profiler: is not present in framework.yaml – Jeroen Jul 04 '18 at 15:12
  • https://symfony.com/doc/current/profiler.html Use the `composer require --dev symfony/profiler-pack` This will create all the config you need because it uses Symfony Flex. I'd guess that Knp Videos are slightly outdated. – domagoj Jul 04 '18 at 15:14
  • web_profiler is not present in framework.yaml – Nestor Jul 04 '18 at 15:14
  • @Domagoj I already did it three or four times, also composer require --dev symfony/debug and nothing – Nestor Jul 04 '18 at 15:15
  • 1
    Hmmm. If you really don't have the file at all then you have been messing with the configuration or you did not load it via composer. Might be best to just start a clean project. No tell what has happened. – Cerad Jul 04 '18 at 15:15
  • Or try and create the file under config/packages/dev/web_profiler.yaml – Jeroen Jul 04 '18 at 15:16
  • @Nestor Command I mentioned is a bit different, are you sure you used the latest version of profiler? The command you mentioned in the question is different than what's in my comment. – domagoj Jul 04 '18 at 15:17
  • If I really had to speculate the video you watched was for Symfony 3 and you tried to upgrade. – Cerad Jul 04 '18 at 15:17
  • Another idea that comes to mind is the environment. `{{ dump(app.environment) }}` If it's not `dev`, that's why there is no debug bar. Also, if you can, check the chrome extension `Symfony2 Profiler` it works with 3.4, can't confirm for Symfony 4. – domagoj Jul 04 '18 at 15:19
  • @Cerad I'm sure they are for Symfony4 [https://knpuniversity.com/screencast/symfony/resume](follow this link) if you wanto. – Nestor Jul 04 '18 at 15:19
  • 1
    @Domagoj what I meant was I did: composer require --dev symfony/profiler-pack and composer require --dev symfony/debug – Nestor Jul 04 '18 at 15:21
  • @Domagoj I'm using dev: php bin/console returns: Symfony 4.1.1 (kernel: src, env: dev, debug: true) – Nestor Jul 04 '18 at 15:23
  • If you set `toolbar: true` and clear cache? What happens? – domagoj Jul 04 '18 at 15:24
  • Well the posted parts of composer.json suggests strange things happened. They show 4.0 even though you seem to be running 4.1. If you really want to get to the bottom of this then make a new directory and run "composer create-project symfony/website-skeleton .' This will load everything you need. And then if you really want to you can compare your project with the working project to see what has changed. Otherwise, you will just be chasing your tail. – Cerad Jul 04 '18 at 15:24
  • @Cerad i will do that again though it will take some time due to my bandwith, when it's ready I will comment it here – Nestor Jul 04 '18 at 15:28
  • I'm beginner too. At first I think it didn't work as you. After that I knew the "slick black bar at the bottom..." only shows up for the pages that uses Twig! what about you? – Nava Mar 01 '19 at 21:17

2 Answers2

12

I've just installed new project and I can confirm that the profiler and toolbar are enabled by default. Configuration is found in config/packages/dev/web_profiler.yaml with the following configuration:

web_profiler:
    toolbar: true
    intercept_redirects: false

framework:
    profiler: { only_exceptions: false }
domagoj
  • 906
  • 1
  • 8
  • 20
  • Did you run >composer create-project symfony/skeleton ? – Nestor Jul 04 '18 at 15:37
  • 1
    No. I ran `symfony/website-skeleton` `skeleton` is for API's and Microservices. If you did skeleton, you're probably missing Twig bundle and perhaps more – domagoj Jul 04 '18 at 15:41
  • Can you render any views in your application? – domagoj Jul 04 '18 at 15:42
  • 1
    Yes I can render views @Domagoj – Nestor Jul 04 '18 at 15:55
  • you need to enable toolbar like in my `web_profiler.yaml`, clear cache and then try to debug container and profiler – domagoj Jul 04 '18 at 15:57
  • you can create it, with the config I posted, clear cache, and debug the container again – domagoj Jul 04 '18 at 16:08
  • and paste the output @Nestor – domagoj Jul 04 '18 at 16:08
  • Ah, so now, it appears you're missing the named routes for profiler... it's very weird, the fact that the composer didn't boilerplate this for you when you installed the package. My next advice is that you try to remove all what came with your recent attempts to install the profiler pack, and re-do it and try to see if there is any error output or try to figure out why symfony flex didn't create all the files for you. Or you could try to create a fresh skeleton and try to install it there. – domagoj Jul 04 '18 at 16:34
  • 3
    `framework: profiler: { only_exceptions: false }` this part helped me. Thank you! – alumi Aug 20 '18 at 16:02
3

Please be aware, that you have to attach web_profiler routes.

in:

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
deyvw
  • 820
  • 7
  • 9