This package provides a Filament page that you can monitor the health of your application by registering checks using the spatie/laravel-health package.
![Screenshot 2023-08-04 at 10 06 01 PM](https://private-user-images.githubusercontent.com/21066418/258472695-fe0b9b55-04ef-4ea9-b89f-bd6e0cf0964a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc5MTgxMDgsIm5iZiI6MTcxNzkxNzgwOCwicGF0aCI6Ii8yMTA2NjQxOC8yNTg0NzI2OTUtZmUwYjliNTUtMDRlZi00ZWE5LWI4OWYtYmQ2ZTBjZjA5NjRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjA5VDA3MjMyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEwOWMwMjAxYTM4M2Y1MDcwZTEzOGE2N2QxYTM2MmQ3NTBmOGEwMzY3MmQxNzg4OWE3NzU2Yjk4YTA5NGU0ZWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cYphXNa3jcqNtXOfU33HlymHODCtjfCZKKMbBZ4FvDo)
You can install the package via composer:
composer require shuvroroy/filament-spatie-laravel-health
This package can store health check results in various ways. When using the EloquentHealthResultStore the check results will be stored in the database. To create the health_check_result_history_items table, you must create and run the migration.
php artisan vendor:publish --tag="health-migrations"
php artisan migrate
Publish the package's assets:
php artisan filament:assets
You first need to register the plugin with Filament. This can be done inside of your PanelProvider
, e.g. 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());
}
}
Then register Health::checks on app/Providers/AppServiceProvider.php -> boot
method
<?php
namespace App\Providers;
use Spatie\Health\Facades\Health;
use Spatie\Health\Checks\Checks\OptimizedAppCheck;
use Spatie\Health\Checks\Checks\DebugModeCheck;
use Spatie\Health\Checks\Checks\EnvironmentCheck;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
Health::checks([
OptimizedAppCheck::new(),
DebugModeCheck::new(),
EnvironmentCheck::new(),
]);
}
}
Read the full documentation on Spatie Laravel Health
If you want to override the default HealthCheckResults
page icon, heading then you can extend the page class and override the navigationIcon
property and getHeading
method and so on.
<?php
namespace App\Filament\Pages;
use ShuvroRoy\FilamentSpatieLaravelHealth\Pages\HealthCheckResults as BaseHealthCheckResults;
class HealthCheckResults extends BaseHealthCheckResults
{
protected static ?string $navigationIcon = 'heroicon-o-cpu-chip';
public function getHeading(): string | Htmlable
{
return 'Health Check Results'
}
public static function getNavigationGroup(): ?string
{
return 'Core';
}
}
Then register the extended page class on AdminPanelProvider
class.
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelHealth\FilamentSpatieLaravelHealthPlugin;
use App\Filament\Pages\HealthCheckResults;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelHealthPlugin::make()
->usingPage(HealthCheckResults::class)
);
}
}
Please see UPGRADE for details on how to upgrade 1.X to 2.0.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.