shuvroroy / filament-spatie-laravel-health
This plugin is built on top of Spatie's Laravel-health package
Package info
github.com/shuvroroy/filament-spatie-laravel-health
pkg:composer/shuvroroy/filament-spatie-laravel-health
Fund package maintenance!
Requires
- php: ^8.2
- filament/filament: ^4.0|^5.0
- spatie/laravel-health: ^1.23
- spatie/laravel-package-tools: ^1.9
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.0||^8.0||^9.0
- orchestra/testbench: ^9.0||^10.0||^11.0
- pestphp/pest: ^2.0||^3.0||^4.0||^5.0
- pestphp/pest-plugin-arch: ^2.0||^3.0||^4.0||^5.0
- pestphp/pest-plugin-laravel: ^2.0||^3.0||^4.0||^5.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v3.5.0
- v3.4.0
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.0
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.0
- v3.0.0-beta1
- 2.x-dev
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v1.6.1
- 1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- dev-feat/check-history-drawer
- dev-feat/authorize-running-health-checks
- dev-feat/health-check-details-and-groups
- dev-feat/clickable-health-history
- dev-feat/health-dashboard-widget
- dev-support-php-8.6
This package is auto-updated.
Last update: 2026-11-28 11:53:28 UTC
README
This package adds a Filament page for monitoring checks registered with spatie/laravel-health. It supports Filament 4 and 5 and PHP 8.2 or newer. CI tests PHP 8.6 with Laravel 13.
| Light mode | Dark mode |
|---|---|
![]() |
![]() |
Installation
Install the package via Composer:
composer require shuvroroy/filament-spatie-laravel-health
Laravel Health can store results in various ways. If you use its default Eloquent result store, publish and run the migration that creates the health_check_result_history_items table:
php artisan vendor:publish --tag="health-migrations"
php artisan migrate
Usage
Register the plugin in your Filament panel provider, such as AdminPanelProvider:
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use ShuvroRoy\FilamentSpatieLaravelHealth\FilamentSpatieLaravelHealthPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin(FilamentSpatieLaravelHealthPlugin::make()); } }
After registering the plugin, publish the panel assets:
php artisan filament:assets
Register your health checks in the boot() method of app/Providers/AppServiceProvider.php:
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Spatie\Health\Facades\Health; use Spatie\Health\Checks\Checks\DebugModeCheck; use Spatie\Health\Checks\Checks\EnvironmentCheck; use Spatie\Health\Checks\Checks\OptimizedAppCheck; class AppServiceProvider extends ServiceProvider { public function boot(): void { Health::checks([ OptimizedAppCheck::new(), DebugModeCheck::new(), EnvironmentCheck::new(), ]); } }
See the available checks in the Laravel Health documentation.
Viewing results
Open Application Health in the panel to see the latest stored results. Select Needs attention to show warnings, failures, and crashed checks. Skipped checks also appear when Spatie's health.treat_skipped_as_failure setting is enabled (the default). The filtered URL can be bookmarked or shared with another authorized user.
Select Run checks to execute the registered checks and update their results, or run php artisan health:check. Opening the page and switching filters read the stored results.
Check details
Select View details to read a check's full message and recorded values from the run you opened. With Spatie's Eloquent result store, every card also includes Recent history. It loads up to 10 recorded outcomes for that check by name, newest first. Each row shows when the check ran and its status. Even when viewing an older run, the history shows the most recent outcomes still in storage.
With a latest-only store, View details appears when the message is truncated, the check has an additional summary, or it has metadata configured for display.
| Light mode | Dark mode |
|---|---|
![]() |
![]() |
To display metadata, call checkMetadata() in your panel provider. Use the check's stored name as the outer key. For example, a check registered with ->name('Disk') can expose its disk usage as follows.
FilamentSpatieLaravelHealthPlugin::make() ->checkMetadata([ 'Disk' => ['disk_space_used_percentage' => 'Disk used (%)'], ]);
Each field maps a top-level metadata key to its display label. Only configured fields with a non-empty string, number, or boolean value are shown.
Optional dashboard widget
Enable the widget in the panel provider for each dashboard where you want it:
$panel->plugin(FilamentSpatieLaravelHealthPlugin::make()->dashboardWidget());
| Light mode | Dark mode |
|---|---|
![]() |
![]() |
The widget reads saved results every minute while visible. It lists affected checks by severity, starting with crashed and failed checks. A single check shows its message inline. When several checks share a status, the header shows the total and previews up to three names. Expand it to see the full list and each check's message preview.
Select All checks in the widget header to open the full list. When checks need attention, select Needs attention beside the chart to open the filtered results.
With Spatie's Eloquent store active and at least two recorded runs, the chart shows how many checks needed attention in each of the last 12 runs, oldest first. With one run or a latest-only store, it shows the latest status breakdown.
Hover or focus a bar to see its run time and affected count. Select the bar to open that saved run with Needs attention selected. Switch to All checks to inspect the other results from the same run, or share the URL. Back to latest opens the current results. If retention has removed a run, its link shows an unavailable message.
The widget checks the plugin's authorize() callback and the configured results page's canAccess() method before reading health results. If your custom page restricts access through route middleware, apply the same policy through authorize() before enabling the widget. The widget runs on the dashboard route, where the results page's middleware does not run.
Customising the navigation
The plugin exposes methods for changing the page's navigation group, sort order, icon, and label. Each option also accepts a closure when the value needs to be determined at runtime.
FilamentSpatieLaravelHealthPlugin::make() ->navigationGroup('System') ->navigationSort(10) ->navigationIcon('heroicon-o-cpu-chip') ->navigationLabel('Application Health');
Pass null to navigationGroup() to remove the default navigation group. Pass null to navigationLabel() to use the translated default label.
Using a custom page
Extend the default page when you need to customise page-specific behavior, such as its heading or view. Configure navigation through the plugin methods described above.
<?php namespace App\Filament\Pages; use Illuminate\Contracts\Support\Htmlable; use ShuvroRoy\FilamentSpatieLaravelHealth\Pages\HealthCheckResults as BaseHealthCheckResults; class HealthCheckResults extends BaseHealthCheckResults { public function getHeading(): string | Htmlable { return 'Health Check Results'; } }
Then pass the custom page class to the plugin in your panel provider:
<?php namespace App\Providers\Filament; use App\Filament\Pages\HealthCheckResults; use Filament\Panel; use Filament\PanelProvider; use ShuvroRoy\FilamentSpatieLaravelHealth\FilamentSpatieLaravelHealthPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( FilamentSpatieLaravelHealthPlugin::make() ->usingPage(HealthCheckResults::class), ); } }
Authorising access
The page is accessible by default. Pass a boolean or closure to authorize() to restrict access:
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use ShuvroRoy\FilamentSpatieLaravelHealth\FilamentSpatieLaravelHealthPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( FilamentSpatieLaravelHealthPlugin::make() ->authorize(fn (): bool => auth()->user()?->email === 'admin@example.com'), ); } }
Restricting who can run checks
By default, users with access to the results page can run checks. Use authorizeRunChecks() in your panel provider to give operators that permission while other viewers can still inspect and share results. This example uses two abilities defined by your application.
use Illuminate\Support\Facades\Gate; FilamentSpatieLaravelHealthPlugin::make() ->authorize(fn (): bool => Gate::allows('viewHealth')) ->authorizeRunChecks(fn (): bool => Gate::allows('runHealthChecks'));
Pass false to authorizeRunChecks() for a read-only panel. The setting applies to manual runs from Filament. Scheduled checks and the Artisan command continue to use your existing configuration.
Upgrading
Please see UPGRADE for details on how to upgrade 1.X to 2.0.
Testing
composer test
composer test:coverage
composer analyse
composer format
The coverage command requires Xdebug or PCOV and fails when coverage is below 100%.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.





