Laravel Pulse is a monitoring tool for Laravel applications. Laravel Pulse is a real-time application monitoring package for Laravel that helps you track your application’s performance and health. It provides insights into requests, slow queries, jobs, exceptions, cache usage, and server activity through a clean dashboard, making it easier to identify bottlenecks, troubleshoot issues, and optimize your application’s performance.
Think of it as a health dashboard for your website. It helps you see:
- Website requests
- Slow pages
- Database queries
- Errors
- Server performance
How it works?
Imagine you run a small online store built with Laravel.
A customer opens the /products page, but it feels slow. You do not know why. Laravel Pulse helps you find the reason.
For example, Pulse may show:
- The /products page took 3 seconds to load
- The page made 20 database queries
- One query was repeated many times
- There were 2 errors during the request
Now you can understand the problem clearly. Instead of guessing, you can fix the slow query or improve the page.
So, Laravel Pulse works like a report card for your website. It tells you what is happening behind the scenes.
Step 1: Create a Laravel Project
If you don’t already have a Laravel project:
composer create-project laravel/laravel laravel-pulse-project
Move into the project folder:
cd laravel-pulse-project
Step 2: Configure the Database
Make sure your database is ready.
- Open MySQL
- Create a database
- Update the
.envfile with the correct database name, username, and password
Example .env settings for MySQL:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_pulse
DB_USERNAME=root
DB_PASSWORD=
Run:
php artisan migrate
Step 3: Start Laravel
Run:
php artisan serve
Expected output:
INFO Server running on http://127.0.0.1:8000
Open the URL in your browser.
Step 4: Install Laravel Pulse
Open another terminal and install the package using Composer:
composer require laravel/pulse
Step 5: Publish Pulse Configuration and Migration Files
Run:
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider"
This command copies Pulse files into your project, such as:
- the Pulse configuration file
- the Pulse migration files
Now you can edit the configuration later if needed.
Step 6: Run Database Migrations
Pulse needs database tables to store its data.
Run:
php artisan migrate
This creates the tables needed for Pulse.
Important:
If your database is not created or not configured correctly, this command will fail.
Step 7: Open the Pulse Dashboard
Once the migrations have been run, you may access the Pulse dashboard via the /pulse route.
Open:
http://127.0.0.1:8000/pulse
You should now see the Pulse dashboard.
Step 8: Generate Website Traffic
Open:
http://127.0.0.1:8000
Refresh the page several times.
Visit different pages if available.
This helps Pulse collect data.
Step 9: If No Data Appears
- Make sure your Laravel app is running.
- Visit your website several times.
- Wait a minute.
- Refresh the Pulse dashboard.
- If your app uses queues, run this in another terminal:
php artisan queue:work
Pulse needs some activity before it can show useful statistics.
Easy Analogy
Imagine a school:
Students = Website Visitors
School = Laravel Application
Principal Dashboard = Pulse Dashboard
Staff Collecting Reports = Queue Worker
School Records = Database
Flow:
Visitor opens website
↓
Laravel handles request
↓
Pulse records information
↓
Queue Worker processes data
↓
Database stores statistics
↓
Pulse Dashboard displays reports
Commands Summary
composer create-project laravel/laravel pulse-demo
cd pulse-demo
composer require laravel/pulse
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider"
php artisan migrate
php artisan serve
Open another terminal:
php artisan queue:work
Then visit:
http://127.0.0.1:8000/pulse
Refresh your website a few times and check the Pulse dashboard again.
You should now see Laravel Pulse collecting and displaying data.
