Home » Php » php – Laravel 5: Enable laravel-debugbar

php – Laravel 5: Enable laravel-debugbar

Posted by: admin April 23, 2020 Leave a comment

Questions:

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

How to&Answers:

Try this command

php artisan config:clear

Answer:

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.

Answer:

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.

Answer:

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,

Answer:

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

Answer:

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.

Answer:

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\[email protected]' );
Route::get( '/api/_debugbar/assets/javascript', '\Barryvdh\Debugbar\Controllers\[email protected]' );

Answer:

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.

Answer:

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.

Answer:

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

Answer:

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"

Answer:

you can go to…

 project foler name->app->app.php

set and 'debug' => true,

This is working perfectly..