- barryvdh/laravel-debugbarというパッケージがあるのでこれを使用する。
barryvdh/laravel-debugbarをインストール
- compose
cd your/laravel/project/path
composer require barryvdh/laravel-debugbar
config値を設定
config/app.php
- config/app.phpの'debug'項目値をtrueに設定する。
-
また、providersとaliasesに下記を追加
config/app.php... /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => env('APP_DEBUG', false), ... /* |-------------------------------------------------------------------------- | Autoloaded Service Providers |-------------------------------------------------------------------------- | | The service providers listed here will be automatically loaded on the | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | */ 'providers' => [ ... //barryvdh/laravel-debugbar Barryvdh\Debugbar\ServiceProvider::class, ], ... /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ 'aliases' => [ ... //barryvdh/laravel-debugbar 'Debugbar' => Barryvdh\Debugbar\Facade::class, ], ...
-
上記のようになっているので、.env.xxxxで設定。
env.xxxxxAPP_DEBUG=true
config/debugbar.php
-
下記のコマンドを叩くと、
config/debugbar.php
が作成される。cd your/laravel/project/path php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
結果
before | after |
---|---|
- デバッグバーが表示されるようになった!