Listen for these to trigger your own workflows — Slack posts, incident logs, status pages. All live in RoundlyConsulting\Alerts\Events:
| Event | Properties | Dispatched when |
|---|---|---|
HealthCheckFailed | $alert | On every failing run once failAfter() is reached — the alert is opened on the first one and reused while open. Not while muted. |
HealthCheckRecovered | $alert | When recoverAfter() consecutive successes close an open alert — once per recovery, even when two runs overlap. Not while muted (the alert still closes). |
HealthCheckEscalated | $alert, $fromLevel, $toLevel | Exactly once each time an open alert reaches a new escalation level. Not while muted. |
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Alerts\Events\HealthCheckFailed;
use RoundlyConsulting\Alerts\Events\HealthCheckRecovered;
Event::listen(function (HealthCheckFailed $event) {
$alert = $event->alert; // the open Alert: status, message, meta, notifiable, healthCheck
});
Event::listen(function (HealthCheckRecovered $event) {
$minutesDown = $event->alert->triggered_at->diffInMinutes($event->alert->recovered_at);
// post an all-clear to your incident channel
});An open alert always reflects the latest failing result: its status and message follow it, so the status report and Health::status() never freeze on the first result. There is at most one open alert per scheduled check, even when two runs overlap.
Notifying on recovery
No notification is sent on recovery. Send your own from a HealthCheckRecovered listener:
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use RoundlyConsulting\Alerts\Events\HealthCheckRecovered;
Event::listen(function (HealthCheckRecovered $event): void {
$event->alert->healthCheck?->forEachNotifiable(
fn (object $notifiable) => Notification::send($notifiable, new CheckRecoveredNotification($event->alert)),
);
});The events use SerializesModels, so queued listeners receive a fresh Alert.
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 cryptoBy 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.