Laravel 5: Enable laravel-debugbar
Asked Answered
S

13

43

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

Stoat answered 3/5, 2015 at 9:1 Comment(8)
Did you do a composer dump-autoload?Topper
Yes I did composer dump-autoloadStoat
What error do you get?Topper
There is no error on the page and no error in the log fileStoat
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-debugbarTopper
Yes, in config/app.php the debug is set to true. In config/debugbar.php enabled.php is set to nullStoat
I have no idea then. sorryTopper
Do I have to modify the .evn.example file?Stoat
R
19

Try this command

php artisan config:clear
Relic answered 26/9, 2015 at 23:8 Comment(1)
This fixes it but why does running php artisan config:cache break it again?Penalize
D
10

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.

Draughts answered 6/5, 2015 at 22:18 Comment(0)
L
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.

Longwise answered 21/3, 2016 at 19:29 Comment(1)
I add to run this too. (Laravel 10).Ploughboy
B
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,

Boorish answered 1/2, 2017 at 14:49 Comment(0)
W
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
Withershins answered 21/11, 2018 at 5:32 Comment(0)
N
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.

Newhouse answered 31/3, 2016 at 15:20 Comment(0)
S
2

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' );
Stratagem answered 27/8, 2017 at 17:6 Comment(0)
P
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.

Pertinent answered 10/3, 2017 at 6:35 Comment(0)
P
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.

Pilloff answered 20/7, 2017 at 10:28 Comment(0)
S
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.

Selfregulated answered 4/2, 2020 at 13:46 Comment(0)
J
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"
Jockstrap answered 17/2, 2020 at 10:39 Comment(0)
B
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!

Betancourt answered 13/11, 2022 at 18:11 Comment(0)
S
-4

you can go to...

 project foler name->app->app.php

set and 'debug' => true,

This is working perfectly..
Sycophancy answered 10/10, 2015 at 11:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.