NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Alerts for Laravel

Built-in checks

The package ships fluent checks for the common cases, each with a default notification so you do not have to write one:

use RoundlyConsulting\Alerts\Checks\{CacheCheck, DatabaseCheck, HttpPingCheck, QueueCheck, StorageCheck};
use RoundlyConsulting\Alerts\Facades\Health;

Health::check(DatabaseCheck::make('mysql'));
Health::check(CacheCheck::make('redis'));
Health::check(QueueCheck::make()->onQueue('emails')->maxSize(1000));
Health::check(StorageCheck::make('uploads')->minimumBytes(2 * 1024 ** 3));
Health::check(HttpPingCheck::make('https://api.example.com')->timeout(5)->expectStatus(200)->slowerThan(800));
CheckHealthy whenWarns whenFails when
DatabaseCheckthe connection opens—the connection is unreachable
CacheChecka sentinel value round-trips—the store is unreachable or returns a mismatch
QueueCheckthe connection resolvesbacklog exceeds maxSize()the connection cannot be resolved
StorageCheckfree space is comfortablespace dips below the warning thresholdspace is below minimumBytes()
HttpPingCheckthe expected status returnsthe response is slower than slowerThan()the status is unexpected or the request times out

Options and defaults

CheckKeyConfigure withDefaults
DatabaseCheckdatabase_checkmake(?string $connection), connection(string)database.default; opens the PDO connection
CacheCheckcache_checkmake(?string $store), store(string)cache.default; writes alerts:cache-check for 10 seconds and reads it back
QueueCheckqueue_checkmake(?string $connection), connection(string), onQueue(string), maxSize(int)queue.default, the default queue, no backlog limit
StorageCheckstorage_checkmake(?string $disk), disk(string), minimumBytes(int), warnBytes(int)filesystems.default; fails below 1 GB free, warns below 2× the minimum
HttpPingCheckhttp_ping_checkmake(string $url), timeout(int $seconds), expectStatus(int), slowerThan(int $ms)5-second request timeout, expects 200, no latency budget
use RoundlyConsulting\Alerts\Checks\QueueCheck;
use RoundlyConsulting\Alerts\Checks\StorageCheck;

Health::check(
    StorageCheck::make('local')
        ->minimumBytes(5 * 1024 ** 3)   // fail below 5 GB free
        ->warnBytes(20 * 1024 ** 3)     // warn below 20 GB free
);

Health::check(QueueCheck::make('redis')->onQueue('default')->maxSize(500));
  • StorageCheck reads free space at the disk’s local root path, so point it at a local disk. Without warnBytes() it warns below twice the minimum.
  • HttpPingCheck’s timeout() is the HTTP request timeout. It is separate from the per-monitor timeout() on the scheduling builder.
  • Each result carries useful meta: connection, store, size and max_size, free_bytes and minimum_bytes, or url, status and latency_ms — plus error when an exception was caught.
  • Result messages come from the alerts::checks translation file, so you can reword them after publishing the translations.
  • Each built-in registers under the key in the table. To run several instances of one built-in — two databases, three endpoints — give each its own key with as() (see Registering checks).

Scheduling a built-in check

Register the configured instance once, then schedule it by class for each owner. The row stores only the key; at run time the registered instance, with its URL, connection or thresholds, does the work:

// Register the configured instance once, in a service provider…
Health::check(HttpPingCheck::make('https://api.example.com/health')->slowerThan(800));

// …then attach it to every owner that should hear about it.
Health::for($team)->monitor(HttpPingCheck::class)
    ->everyMinute()
    ->failAfter(2)
    ->save();

An instance registered with as() is scheduled by its key instead — Health::for($team)->monitor('mysql_database'). Every built-in check notifies with the bundled HealthCheckFailedNotification, which includes the failure reason, and honours notifyVia() channel routing (see Notifications & throttling).

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.