Laravel 11 - Debugbar
Laravel 11 - Debugbar
This tutorial covers integrating Debugbar in Laravel 11, a powerful tool for debugging and profiling, helping developers optimize performance and troubleshoot issues efficiently.
If you're a video person, feel free to skip the post and check out the video instead!
Step # 1 : Create fresh Laravel project or use existing project.
Two commands to create fresh laravel project
Global Command : laravel new debugbar
Or use
Non Global Command : composer create-project laravel/laravel --prefer-dist debugbar
Step # 2 : Access the project.
Open a terminal (e.g., Git Bash) and navigate to your Laravel project's root folder.
Git Bash : cd c:xampp/htdocs/debugbar
Step # 3 : Install the package.
Command : composer require barryvdh/laravel-debugbar --dev
The package will automatically register itself.
Step # 4 : Publish the configuration.
Command : php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
Step # 5 : Enable Debugbar.
Make sure Debugbar is enabled only for local environments.
APP_ENV=local
DEBUGBAR_ENABLED=true
Step # 6 : Start the Laravel development server.
Command : php artisan serve.
Access below URL
127.0.0.1:8000You will see Debugbar
Expand Debugbar, Select Queries Tab
View Tab
Example :
Update the route and fetch all users.
<?php
use App\Models\User;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
User::all();
return view('welcome');
});
Reload the browser and click on the Queries tab in Debugbar.
Why use Debugbar?
- SQL Query Monitoring
- Performance Insights
- Route Inspection
- View Rendering Debugging
- Exception and Log Monitoring
Share this with friends!
To engage in commentary, kindly proceed by logging in or registering
Subscribe to Our Newsletter
Stay ahead of the curve! Join our newsletter to see what everyone’s talking about.
0 Comments