Skip to main content
Back to packages
876 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