21
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel 5.3でデバッグバーを使用する方法

Last updated at Posted at 2016-09-22

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.xxxxx
     APP_DEBUG=true
    

config/debugbar.php

  • 下記のコマンドを叩くと、config/debugbar.php が作成される。

     cd your/laravel/project/path
     php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
    

結果

before after
debugbar-before.png debugbar-after.png

|

  • デバッグバーが表示されるようになった!
21
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
27

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?