anourvalar / laravel-health
Additional Checks for Laravel Health (Spatie)
Installs: 23 975
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: ^8.0|^9.0|^10.0|^11.0
- spatie/laravel-health: ^1.29
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.26
- orchestra/testbench: ^8.6
- phpstan/phpstan: ^1.10
- psalm/plugin-laravel: ^2.8
- squizlabs/php_codesniffer: ^3.7
README
Installation
composer require anourvalar/laravel-health
Checks for spatie/laravel-health
FilesystemCheck
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\FilesystemCheck::new()->disks(['s3' => ($checkPublicUrl = true)]), ]);
OpcacheCheck
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\OpcacheCheck::new(), ]);
PusherCheck
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\PusherCheck::new()->connection(null), // default connection ]);
QueueFailedCheck
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\QueueFailedCheck::new(), ]);
XdebugCheck
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\XdebugCheck::new(), ]);
SSL Certificate
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\SSLCertCheck::new() ->url('google.com') ->warnWhenExpiringDay(10) ->failWhenExpiringDay(2), ]);
Cpu Load
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\CpuLoadCheck::new()->failWhenLoadIsHigher( 2.5, // last minute 2.0, // last 5 minutes 1.5 // last 15 minutes ), ]);
Gzip
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\GzipCheck::new() ->shouldBeGzipped('/') ->shouldNotBeGzipped('/image.png'), ]);
Reverse Proxy Security
First, you need to register a route for the checker.
Route::any('/health-ping', HealthPingController::class);
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\ReverseProxySecurityCheck::new()->url('/health-ping'), ]);
HTTP -> HTTPS 301 redirect
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\Http2HttpsCheck::new() ->shouldBeRedirected(['/', '/image.png']), ]);
WWW -> none WWW 301 redirect
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\Www2NoneCheck::new() ->shouldBeRedirected(['/', '/image.png']), ]);
Mailer
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\MailerCheck::new() ->mailer(null), // default ]);
Sentry
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\SentryCheck::new(), ]);
Directory Permissions
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\DirectoryPermissionsCheck::new() ->writable(storage_path('logs')) ->notWritable(app_path('')), ]);
CORS
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\CorsCheck::new() ->allowed('https://good.com') ->disallowed('https://evil.com') ->url('api/sanctum/csrf-cookie'), // target endpoint ]);
Cache Headers
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\CacheHeadersCheck::new() ->shouldBeCached('/image.png') ->shouldNotBeCached('/'), ]);
Root (user)
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\RootCheck::new(), ]);
FastCGI
First, you need to register a route for the checker.
Route::any('/health-ping', HealthPingController::class);
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\FastCGICheck::new()->url('/health-ping'), ]);
Queue size
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\QueueSizeCheck::new() ->add(['connection' => null, 'name' => null, 'max_size' => 200]), ]);
Octane server
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\OctaneCheck::new(), ]);
Redis Config
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\RedisConfigCheck::new(), ]);
HTTP/2
\Spatie\Health\Facades\Health::checks([ \AnourValar\LaravelHealth\HttpV2::new()->urls('/'), ]);