shuvroroy / filament-spatie-laravel-health
This plugin is built on top of Spatie's Laravel-health package
Fund package maintenance!
shuvroroy
Installs: 193 808
Dependents: 7
Suggesters: 0
Security: 0
Stars: 161
Watchers: 2
Forks: 25
Open Issues: 4
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-health: ^1.23
- spatie/laravel-package-tools: ^1.15
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
This package provides a Filament page that you can monitor the health of your application by registering checks using the spatie/laravel-health package.
Support For This Project
Installation
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
Usage
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) ); } }
Upgrading
Please see UPGRADE for details on how to upgrade 1.X to 2.0.
Testing
composer test
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.