• Reading time ~ 1 min
  • 09.07.2022

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
  • Environment
  • Flare Error Count
  • Horizon
  • MeiliSearch
  • Ping
  • Redis
  • Schedule
  • 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.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297