laravel/pulse
Laravel Pulse is a real-time performance monitoring tool and dashboard for Laravel. Track requests, slow queries, jobs, cache usage, and other application metrics to spot issues quickly and keep your app healthy in production.
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
Access the dashboard at /pulse (or your configured route).
Pulse::record() to log custom events:
use Laravel\Pulse\Facades\Pulse;
Pulse::record('custom_event', ['key' => 'value']);
.env:
PULSE_ENABLED=true
PULSE_TRIM_DURATION=14 # Days to retain data
config/pulse.php:
'thresholds' => [
'requests' => 1000, // ms
'queries' => 500, // ms
],
Debugging Slow Requests:
Queue Monitoring:
Pulse::record('job:failed', ['job' => $job]) to log custom job failures:
try {
$job->handle();
} catch (\Exception $e) {
Pulse::record('job:failed', [
'job' => $job->getName(),
'exception' => $e->getMessage(),
]);
}
Custom Cards:
StripeCard in app/Pulse/Cards/StripeCard.php:
namespace App\Pulse\Cards;
use Laravel\Pulse\Cards\Card;
class StripeCard extends Card
{
public function title(): string
{
return 'Stripe Events';
}
public function graph()
{
return $this->lineChart()
->title('Stripe Events Over Time')
->data(fn () => StripeEvent::query()->countByDay());
}
}
config/pulse.php:
'cards' => [
\App\Pulse\Cards\StripeCard::class,
],
Environment-Specific Tuning:
local environments for performance:
'environments' => [
'local' => false,
],
PULSE_TUNNEL_RESTRICT_LOCAL=true to block private tunnel access in local.Real-Time Alerts:
config/pulse.php:
'thresholds' => [
'requests' => [
'pattern' => 'api/*',
'duration' => 500, // ms
],
],
Livewire Integration:
'livewire' => [
'sort_by' => 'duration', // or 'memory', 'count'
],
Database Query Optimization:
SELECT * FROM users).Custom Metrics with Pulse::set():
Pulse::set('cache_hits', Cache::stats()['hits']);
Pulse::set('cache_misses', Cache::stats()['misses']);
Queue Worker Monitoring:
php artisan queue:work --daemon --tries=3 &
php artisan pulse:work
Dark Mode and Theming:
config/pulse.php:
'theme' => 'dark', // or 'light', 'system'
Performance Overhead:
local or staging:
'environments' => [
'local' => false,
'staging' => false,
],
PULSE_TRIM_DURATION to reduce storage usage.Redis Serialization Issues:
'options' => [
'serialize' => Redis::SERIALIZER_PHP,
],
Livewire Version Conflicts:
composer require livewire/livewire:^4.0
Private Tunnel Security:
local to prevent unauthorized access:
PULSE_TUNNEL_RESTRICT_LOCAL=true
Custom Card Loading:
AppServiceProvider:
public function boot()
{
Pulse::extend(\App\Pulse\Cards\StripeCard::class);
}
Database Prefixing:
pulse_), ensure Pulse’s migrations are prefixed correctly:
'database' => [
'prefix' => 'pulse_',
],
Enum Support:
Pulse::record() and Pulse::set() (Laravel 10+):
Pulse::record('status', UserStatus::Active);
Clear Pulse Data:
php artisan pulse:clear
php artisan migrate:fresh --path=/vendor/laravel/pulse/database/migrations
Check Logs:
storage/logs/pulse.log. Tail logs during development:
tail -f storage/logs/pulse.log
Disable Pulse Temporarily:
PULSE_ENABLED=false in .env to disable without uninstalling.Reload Pulse:
php artisan pulse:reload
Memory Leaks:
composer update laravel/pulse
Custom Skills:
'skills' => [
'pulse-development' => [
'Boost' => function () {
return request()->ip() === '127.0.0.1';
},
],
],
Third-Party Integrations:
Middleware for Custom Metrics:
public function handle(Request $request, Closure $next)
{
Pulse::record('middleware:auth', ['user_id' => auth()->id()]);
return $next($request);
}
Custom Graphs:
public function graph()
{
return $this->lineChart()
->title('API Calls')
->data(fn () => Http
How can I help you explore Laravel packages today?