---
title: "Built-in checks — Alerts for Laravel | Roundly"
description: "Database, cache, queue, storage and HTTP ping checks — their options, thresholds, keys and the default notification they ship with."
url: https://roundly-consulting.com/open-source/docs/alerts-for-laravel/built-in-checks
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Alerts for Laravel](https://roundly-consulting.com/open-source/docs/alerts-for-laravel.md)

# 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:

```php
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));
```

| Check | Healthy when | Warns when | Fails when |
| --- | --- | --- | --- |
| `DatabaseCheck` | the connection opens | — | the connection is unreachable |
| `CacheCheck` | a sentinel value round-trips | — | the store is unreachable or returns a mismatch |
| `QueueCheck` | the connection resolves | backlog exceeds maxSize() | the connection cannot be resolved |
| `StorageCheck` | free space is comfortable | space dips below the warning threshold | space is below minimumBytes() |
| `HttpPingCheck` | the expected status returns | the response is slower than slowerThan() | the status is unexpected or the request times out |

## Options and defaults

| Check | Key | Configure with | Defaults |
| --- | --- | --- | --- |
| `DatabaseCheck` | database\_check | make(?string $connection), connection(string) | database.default; opens the PDO connection |
| `CacheCheck` | cache\_check | make(?string $store), store(string) | cache.default; writes a sentinel under a per-run key (alerts:cache-check:<uuid>, 10 seconds), reads it back and forgets it, so overlapping runs never see each other’s value |
| `QueueCheck` | queue\_check | make(?string $connection), connection(string), onQueue(string), maxSize(int) | queue.default, the default queue, no backlog limit |
| `StorageCheck` | storage\_check | make(?string $disk), disk(string), minimumBytes(int), warnBytes(int) | filesystems.default; fails below 1 GB free, warns below 2× the minimum |
| `HttpPingCheck` | http\_ping\_check | make(string $url), timeout(int $seconds), expectStatus(int), slowerThan(int $ms) | 5-second request timeout, expects 200, no latency budget |

```php
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. That error stays on the returned result and is stored only with store\_exception\_details on; the caught exception is reported to your exception handler either way (a timeout is not).
- Result messages come from the alerts::checks translation file, in English and Slovak, 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:

```php
// 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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## 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.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/alerts-for-laravel.md)
