Steve
Steve

Reputation: 1046

Laravel 5: Enable laravel-debugbar

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

Upvotes: 43

Views: 66894

Answers (14)

shmuels
shmuels

Reputation: 1393

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);

Upvotes: 0

Lalit Kumar Dudeja
Lalit Kumar Dudeja

Reputation: 1

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!

Upvotes: 0

Gabriel Gressie
Gabriel Gressie

Reputation: 1

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.

Upvotes: 0

Aman Kumar
Aman Kumar

Reputation: 1

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"

Upvotes: 0

Shabeer K
Shabeer K

Reputation: 1617

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

Upvotes: 3

Sebastien Horin
Sebastien Horin

Reputation: 11067

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

Upvotes: 2

user570605
user570605

Reputation: 768

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.

Upvotes: 0

jay ramone
jay ramone

Reputation: 19

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.

Upvotes: 1

karthik
karthik

Reputation: 56

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,

Upvotes: 3

Sergio B.
Sergio B.

Reputation: 81

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.

Upvotes: 2

Muihlinn
Muihlinn

Reputation: 571

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.

Upvotes: 6

Ashish Singh
Ashish Singh

Reputation: 2153

you can go to...

 project foler name->app->app.php

set and 'debug' => true,

This is working perfectly..

Upvotes: -4

Łukasz D. Tulikowski
Łukasz D. Tulikowski

Reputation: 1503

Try this command

php artisan config:clear

Upvotes: 19

Remluben
Remluben

Reputation: 1673

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.

Upvotes: 10

Related Questions