Artisan Debug Profiler
Debug Component is commandline profiling package for Laravel, It was based from Laravel 4.1 commandline profiling tool which was merged with php artisan tail
.
Version Compatibility
Laravel | Debug |
---|---|
4.0.x | 2.0.x |
4.1.x | 2.1.x |
4.2.x | 2.2.x |
5.0.x | 3.0.x |
5.1.x | 3.1.x |
5.2.x | [email protected] |
Installation
To install through composer, simply put the following in your composer.json
file:
{
"require-dev": {
"orchestra/debug": "~3.0"
}
}
And then run composer install
from the terminal.
Quick Installation
Above installation can also be simplify by using the following command:
composer require --dev "orchestra/debug=~3.0"
Configuration
Next add the following service provider in config/app.php
or use Config Component to handle environment based providers.
'providers' => [
// ...
Orchestra\Debug\DebugServiceProvider::class,
Orchestra\Debug\CommandServiceProvider::class,
],
Aliases
You could also create an alias for Orchestra\Support\Facades\Profiler
in config/app.php
.
'aliases' => [
'Profiler' => Orchestra\Support\Facades\Profiler::class,
],
Usage
Enabling Profiler
To enable the profiler, all you need to do add the following to App\Providers\AppServiceProvider
:
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Boot the service provider.
*
* @return void
*/
public function boot()
{
if (config('app.debug')) {
Profiler::attachDebugger();
}
}
}
Viewing the Profiler
To view the profiler, run the following command in your terminal:
php artisan debug