Skip to main content
Back to packages
891 GitHub stars

spatie/laravel-health

View on GitHub

Description

Using this package you can monitor the health of your application by registering checks.

Here's an example where we'll monitor available disk space.

// typically, in a service provider
 
use Spatie\Health\Facades\Health;
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;
 
Health::checks([
UsedDiskSpaceCheck::new()
->warnWhenUsedSpaceIsAbovePercentage(70)
->failWhenUsedSpaceIsAbovePercentage(90),
]);

When the used disk space is over 70%, then a notification with a warning will be sent. If it's above 90%, you'll get an error notification. Out of the box, the package can notify you via mail and Slack.

Related Content on Laravel Daily

Video

Recent Courses on Laravel Daily

Mobile Apps: React Native vs Flutter vs NativePHP?

8 lessons
55 min

Roles and Permissions in Laravel 13

14 lessons
57 min

Testing in Laravel 13 For Beginners

26 lessons
1 h 41 min read