laravel/pulse
Laravel Pulse is a real-time performance monitoring tool and dashboard for Laravel apps. Track key runtime metrics, identify slow requests and bottlenecks, and keep tabs on application health in production with minimal setup.
Installation:
composer require laravel/pulse
php artisan pulse:install
This publishes the Pulse migration, config, and assets.
Run Migrations:
php artisan migrate
Start Pulse:
php artisan pulse:start
This boots the Pulse dashboard on http://localhost:8080 (or your configured port).
First Use Case:
Monitoring Application Health:
config/pulse.php:
'thresholds' => [
'requests' => [
'slow' => 500, // ms
],
'jobs' => [
'slow' => 10000, // ms
],
'queries' => [
'slow' => 200, // ms
],
],
Custom Metrics with Pulse::record():
use Laravel\Pulse\Facades\Pulse;
// Record a custom metric
Pulse::record('checkout.conversions', 1);
// Set a custom value (e.g., for dashboards)
Pulse::set('current_users', $userCount);
Queue Monitoring:
Exception Tracking:
Log Inspection:
error, info) or search for specific messages.Server Metrics:
Database Queries:
Livewire Monitoring:
Environment-Specific Configuration:
PULSE_ENABLED=false in .env:
PULSE_ENABLED=false
PULSE_PORT=8081 to change the dashboard port.Custom Cards:
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider" --tag="pulse-config"
config/pulse.php under the cards array:
'cards' => [
\App\Pulse\Cards\CustomCard::class,
],
Sampling:
config/pulse.php:
'sampling' => [
'requests' => 10, // Sample 10% of requests
'queries' => 20, // Sample 20% of queries
],
Authentication:
routes/pulse.php:
Route::middleware(['auth'])->group(function () {
// Dashboard routes
});
Data Retention:
'trim' => [
'duration' => 14, // Days
],
pulse:trim command manually to clean up old data:
php artisan pulse:trim
Private Tunnel (Local Development):
pulse:tunnel to expose your local Pulse dashboard securely:
php artisan pulse:tunnel
Performance Overhead:
'sampling' => ['requests' => 10]) to reduce load.Redis Memory Leaks:
Livewire Version Conflicts:
Database Prefixing Issues:
pulse_*) in PostgreSQL or SQLite.Dark Mode Quirks:
theme config is misconfigured.PULSE_THEME=dark in .env or use system for OS-level preference.Private Tunnel Security:
pulse:tunnel command exposes your dashboard publicly. Avoid using it in sensitive environments.local environments only (configurable in config/pulse.php).Enum Support:
Pulse::record().Pulse::record('status', $enum->value);
Dashboard Not Loading:
pulse:start command is running and the port is free.PULSE_PORT in .env.npm install && npm run dev in the resources/js directory.Missing Metrics:
PULSE_ENABLED=true).pulse table exists in your database. Run migrations if needed:
php artisan migrate
Slow Queries Not Showing:
DB::enableQueryLog() at the start of your request lifecycle (e.g., in a middleware).Livewire Card Blank:
livewire package is patched (if using an older version).Custom Metrics Not Appearing:
Pulse::record() or Pulse::set() correctly. Metrics are stored in the pulse_metrics table.pulse_metrics table directly or verify your code is executing during a monitored request.Laravel\Pulse\Cards\Card:
namespace App\Pulse\Cards;
use Laravel\Pulse\Cards\Card;
class CustomCard extends Card
{
public function title(): string
{
return 'Custom Metric';
}
public function graph()
{
return $this->lineChart()
->title('Custom Data Over Time')
->data($this->getCustomData());
}
protected function getCustomData()
How can I help you explore Laravel packages today?