44

I'm using Laravel 5 and would like to use the barryvdh/laravel-debugbar. After the installation and configuration the bar is not showing.

I did the following:

Installation:

composer require barryvdh/laravel-debugbar

Add the following lines to the config/app.php

'Barryvdh\Debugbar\ServiceProvider',

'Debugbar' => 'Barryvdh\Debugbar\Facade',

Further I execute:

php artisan vendor:publish

which generates the debugbar.php file within the config folder.

Any ideas what could be missing?

Thank you

UPDATE:

I made a fresh Laravel 5 installation and installed the debugbar which works perfectly and showed my the debugbar. After executing the artisan commands:

 php artisan cache:clear 

and

 php artisan config:cache

the debugbar is not visible anymore. I think this was also my problem of the previous question. Any ideas why this happens and how I can make the debugbar revisible?Thank you

8
  • Did you do a composer dump-autoload? Commented May 3, 2015 at 9:38
  • Yes I did composer dump-autoload Commented May 3, 2015 at 9:40
  • What error do you get? Commented May 3, 2015 at 9:41
  • There is no error on the page and no error in the log file Commented May 3, 2015 at 9:42
  • Do you have debug set to true? From the docs: The profiler is enabled by default, if you have app.debug=true. github.com/barryvdh/laravel-debugbar Commented May 3, 2015 at 9:44

14 Answers 14

19

Try this command

php artisan config:clear
Sign up to request clarification or add additional context in comments.

1 Comment

This fixes it but why does running php artisan config:cache break it again?
11

The installation instructions at https://github.com/barryvdh/laravel-debugbar#installation recommend setting the application debug mode to true. Also make sure, that you do not disable the debugbar in config/debugbar.php by setting the enabled=false > If I were you I would simply remove it. ( The debugbar won't work, event if the application itself is in debug mode )

Another suggestion

As far as I know the .env.example file should be renamed to .env and all apropriate variables should be set. In my case it always contains lines like this:

APP_ENV=local
APP_DEBUG=true`

Within the config/app.php file the debug value should be read from the environment variable.

return [
    /* some other config values here... */
    'debug' => env('APP_DEBUG'),
]

Note, that it should also be possible to simply set the value to true without using the environment based configuration values.

Maybe you can test it by manually calling \Debugbar::enable(); in one of your routes and debugging afterwards.

Hope this helps.

Comments

6

I have had the same trouble, and it is usually solved clearing route caching.

php artisan route:clear

It seemed to be an issue which was already fixed, and you can find about it in the repository issue #287, but I'm still finding it from time to time.

1 Comment

I add to run this too. (Laravel 10).
3

Paste this lines in your Config/app.php surely it will work

  1. In providers:

Barryvdh\Debugbar\ServiceProvider::class,

  1. In aliases:

'Debugbar' => Barryvdh\Debugbar\Facade::class,

Comments

3

In my case, the problem was I had a wide route, Route::get('/{all?}','...') catching the debugbar one.

I managed to solve this by adding these routes before:

Route::get( '/api/_debugbar/assets/stylesheets', '\Barryvdh\Debugbar\Controllers\AssetController@css' );
Route::get( '/api/_debugbar/assets/javascript', '\Barryvdh\Debugbar\Controllers\AssetController@js' );

Comments

3

Open the terminal and to do like this as your wise

1) Install DebugBar

  • The DebugBar 2.4.x is for Laravel 5.4-
  • The DebugBar 3.0.x is for Laravel 5.5+

A) Install the debuger 2.4 (Documentation)

composer require barryvdh/laravel-debugbar:~2.4

You will also need to add in providers array in config/app.php :

Barryvdh\Debugbar\ServiceProvider::class

B) Install the debuger 3.0 (Documentation)

composer require barryvdh/laravel-debugbar --dev

2) After that, you need to update the composer

composer update

3) Then after you need to add a line to .env file

APP_DEBUG=true

4) Clear cache and config

php artisan cache:clear

php artisan config:cache

Comments

2

I had the same issue and tried all the previous solutions without success. Finnaly I solved my problem with the following detail fix:

Install instrucions:

If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.

Comments

1

I had this issue because I had catchall route in routes.php

Here was my fix:

  1. comment out the catchall route code block in routes.php
  2. clear the cache

    c:path/to/your/project> php artisan cache:clear

    c:path/to/your/project> php artisan route:clear

  3. load your poject home page in your browser and confirm that you can see the debugbar

  4. uncomment out the catchall route in routes.php

Hopefully this helps someone else.

Comments

0

Check your storage/laravel.log file. In mine was:

local.ERROR: Debugbar exception: Authentication user provider [] is not defined.

Because I misconfigured something in auth.php and when I fixed that debugbar loaded successfully.

Comments

0

to add debugger in your code step 1

  1. composer require barryvdh/laravel-debugbar --dev

inside config/app.php

  • Barryvdh\Debugbar\ServiceProvider::class,
  • 'Debugbar' => Barryvdh\Debugbar\Facade::class,

at last run this command

  1. php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"

Comments

0

If you're daft like me sometimes this can help. At the bottom of your page, make sure you don't write a <script /> but use the full closure eg. <script></script> This was my problem.

Comments

0

I have started learning Laravel from last few days, I was working on a small project. I took the backup from my live server and setup the project on my local system and after that I start facing the "Debug bar not showing" issue. I tried almost all the steps as suggested by you guys, but still no luck.

But this is how I found the solution, I hope someone will save some time by trying the below solution, if he is doing the same mistake.

I found one mistake in my .env file, my APP_URL was set to my live site like APP_URL=https://mylivesite.com, but I was testing on localhost, so after changing the APP_URL to "APP_URL=http://127.0.0.1:8000", and then follow the same steps as you guys are mentioning, It worked for me. Thanks!

Comments

0

The issue was that we were returning an array instead of a string or a blade file. See here for barryvdh's (package owner) comment regarding this.

return [
  'data' => 'test',
];

You can either just return a string see here

return 'ok'

or a blade file.

return view(debugbar);

Comments

-4

you can go to...

 project foler name->app->app.php

set and 'debug' => true,

This is working perfectly..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.