Faster your application with Laravel Debug Bar Package

Faster your application with laravel debugbar package

Hi guys,

In this article, We are studying laravel debugbar packages. You use the Laravel Debug bar package to debug and profile the toolbar in your application. It contains different features like performs, queries, and exceptions. The Laravel Debug bar is a crucial debugging and profiling toolbar for laravel applications. Use the Laravel Debug bar to simplify the debugging process and enhance your productivity during development. It slows the execution of the application because it has to gather data. It helps to simplify the debugging process, boosting your productivity, and you can deliver high-quality laravel applications.

Key Features:

  1. Query Inspection: quickly study and analyze the execution queries and monitor your model performance.
  2. Request Profiling: you can track and display detailed information on requests, memory usage, execution time, and timeline of events.
  3. Logging and Exceptions: it provides a display panel and investigates log messages and exceptions.
  4. Timing and benchmarking: it shows the execution time of code, helping you identify areas of your applications that might need optimization.

Step by Step to step up laravel debug bar

Install the Laravel Debugbar Package

Run the below command to install the laravel debug bar.

composer require barryvdh/laravel-debugbar --dev

Register the debug bar

You need to register and publish the debug bar in your application. Execute the below command:

php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"

Update Debug value

You can edit the .env file and update the APP_DEBUG value to true. For a production environment, This package should be disabled because it causes slow performance.

APP_DEBUG=true
APP_ENV=local

Start your application

You can start your laravel application and check the laravel debug bar on the browser.

Messages
you can showcase different messages on the debugbar like error, info, warning, and addMessage.

use Barryvdh\Debugbar\Facades\Debugbar;

Route::get('/', function(){
Debugbar::info('Info');
Debugbar::error('Error');
Debugbar::warning('Warning');
Debugbar::addMessage('New Message');
return view('welcome');
});

Exceptions
Show log exceptions to debug your application.

use Barryvdh\Debugbar\Facades\Debugbar;

try {
throw new Exception('Sorry, something went wrong);
}
catch(Exception $e)
{
Debugbar::addException($e);
}

Views:
You can see all rendered templates with parameters.

Route:
You can also see the paths that your browser calls.

Queries:
You see the query performance on the Query tab.

Models: show all models currently associated with your application

Gate: Shows Gate checks called in the files

Session: show stored session data

Request: show all the requested information.

Laravel Debugbar is powerful for debugging and showing information inside of your application. It provides insights into queries, performance metrics, log messages, and exceptions. It helps to identify and resolve the issues within your application. So you can fasten your application with the laravel debugbar package.

Thank you for reading this article. Please share this article with your friend circle. That’s it for the day. Stay Connected!
Cheers

Loading

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top