Laravel Pulse
Introduction
Laravel Pulse delivers at-a-glance insights into your application's performance and usage. With Pulse, you can track down bottlenecks like slow jobs and endpoints, find your most active users, and more.
For in-depth debugging of individual events, check out Laravel Telescope.
Installation
Pulse's first-party storage implementation currently requires a MySQL, MariaDB, or PostgreSQL database. If you are using a different database engine, you will need a separate MySQL, MariaDB, or PostgreSQL database for your Pulse data.
You may install Pulse using the Composer package manager:
composer require laravel/pulse
Next, you should publish the Pulse configuration and migration files using the vendor:publish
Artisan command:
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider"
Finally, you should run the migrate
command in order to create the tables needed to store Pulse's data:
php artisan migrate
Once Pulse's database migrations have been run, you may access the Pulse dashboard via the /pulse
route.
If you do not want to store Pulse data in your application's primary database, you may specify a dedicated database connection.
Configuration
Many of Pulse's configuration options can be controlled using environment variables. To see the available options, register new recorders, or configure advanced options, you may publish the config/pulse.php
configuration file:
php artisan vendor:publish --tag=pulse-config
Dashboard
Authorization
The Pulse dashboard may be accessed via the /pulse
route. By default, you will only be able to access this dashboard in the local
environment, so you will need to configure authorization for your production environments by customizing the 'viewPulse'
authorization gate. You can accomplish this within your application's app/Providers/AppServiceProvider.php
file:
use App\Models\User;
use Illuminate\Support\Facades\Gate;
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Gate::define('viewPulse', function (User $user) {
return $user->isAdmin();
});
// ...
}
Customization
The Pulse dashboard cards and layout may be configured by publishing the dashboard view. The dashboard view will be published to resources/views/vendor/pulse/dashboard.blade.php
:
php artisan vendor:publish --tag=pulse-dashboard
The dashboard is powered by Livewire, and allows you to customize the cards and layout without needing to rebuild any JavaScript assets.
Within this file, the <x-pulse>
component is responsible for rendering the dashboard and provides a grid layout for the cards. If you would like the dashboard to span the full width of the screen, you may provide the full-width
prop to the component:
<x-pulse full-width>
...
</x-pulse>
By default, the <x-pulse>
component will create a 12 column grid, but you may customize this using the cols
prop:
<x-pulse cols="16">
...
</x-pulse>