Laravel 5: Enable laravel-debugbar

前端 未结 12 1517
星月不相逢
星月不相逢 2020-12-23 14:19

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:

相关标签:
12条回答
  • 2020-12-23 14:30

    Try this command

    php artisan config:clear
    
    0 讨论(0)
  • 2020-12-23 14:31

    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' );
    
    0 讨论(0)
  • 2020-12-23 14:34

    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.

    0 讨论(0)
  • 2020-12-23 14:35

    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"
    0 讨论(0)
  • 2020-12-23 14:45

    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.

    0 讨论(0)
  • 2020-12-23 14:47

    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.

    0 讨论(0)
提交回复
热议问题