Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Today, I will give you an example of “How to use the Laravel Debugger Package in Laravel”, So you can easily apply it with your laravel 5, laravel 6, laravel 7, and laravel 8 application.
Mostly we use the Laravel Debugger package to check query, models, controller, and memory consumption for improving query optimization.
First, what we’re doing here, This is the example :
Laravel Debugger package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure them through Laravel.
It bootstraps some Collectors to work with Laravel and implements a couple of custom DataCollectors, specific for Laravel. It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown) Read the documentation for more configuration options.
This package includes some custom collectors:
Bootstraps the following collectors for Laravel:
And the default collectors:
Installation
Require this package with the composer. It is recommended to only require the package for development.
composer require barryvdh/laravel-debugbar --dev
Publish configuration file
Publish the package config & resource files.
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
Update Config File :
You need to update your app.php file inside the same config\app.php directory where you need to add the providers and aliases of the package as shown below.
config\app.php
'providers' => [
....
....
....
Barryvdh\Debugbar\ServiceProvider::class,
],
'aliases' => [
....
....
....
'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class,
]
Update .env File
APP_DEBUG=true
Note: When your application is live on the server, do it APP_DEBUG=false.
Output:
In this article, we successfully installed the “Laravel Debugger Package”, I hope this article will help you with your Laravel application Project.
Also Read: How to Backup Laravel application with Database.