Laravel Health is a package by Spatie to monitor the health of your applications. You accomplish this by configuring one or more of the available checks (or creating a custom check). At the time of release, Spatie's Health package has the following checks:
- CPU Load
- Database Connection
- Debug Mode
- Flare Error Count
- Used Disk Space
Here's an example of how you'd register a check as seen in the documentation:
use Spatie\Health\Facades\Health;use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;Health::checks([UsedDiskSpaceCheck::new()->warnWhenUsedSpaceIsAbovePercentage(70)->failWhenUsedSpaceIsAbovePercentage(90),]);
Given the above disk space check, when used space is above 90%, the health package will send a notification via email, Slack, or Oh Dear! Spatie Health automatically throttles notifications so that you'll only receive one notification per hour by default, or you can configure a custom throttling timeframe in minutes.
Lastly, you can view health statuses via a web browser UI provided by this package, from the CLI, or as JSON.
You can learn more about this package, get full installation instructions, and view the source code on GitHub. Also, read A Laravel package to monitor the health of your application for more background on the package.