Skip to content

Configuration

Configuration

All configuration lives in config/health.php. Publish it with:

php artisan vendor:publish --tag="health-config"

Global Toggle

'enabled' => env('HEALTH_ENABLED', true),

Set HEALTH_ENABLED=false to disable all health endpoints.

Endpoints

'endpoints' => [
    'prefix' => env('HEALTH_PREFIX', 'health'),
    'liveness'  => ['path' => '/',             'enabled' => true],
    'readiness' => ['path' => '/ready',        'enabled' => true],
    'startup'   => ['path' => '/startup',      'enabled' => true],
    'status'    => ['path' => '/status',       'enabled' => true],
    'metrics'   => ['path' => '/metrics',      'enabled' => true],
    'json'      => ['path' => '/metrics/json', 'enabled' => true],
    'ui'        => ['path' => '/ui',           'enabled' => false],
],

All paths are relative to the prefix. Override with HEALTH_PREFIX.

Security

'security' => [
    'token' => env('HEALTH_TOKEN'),
    'allowed_ips' => env('HEALTH_ALLOWED_IPS')
        ? explode(',', env('HEALTH_ALLOWED_IPS'))
        : null,
    'public_endpoints' => ['liveness'],
],

'middleware' => ['api'],

See Security for details on token auth, IP allowlists, and custom auth callbacks.

Health Checks

'checks' => [
    'liveness' => [
        DatabaseCheck::class,
    ],
    'readiness' => [
        DatabaseCheck::class,
        CacheCheck::class,
        QueueCheck::class,
        StorageCheck::class,
    ],
    'startup' => [],
],

Each probe runs its own set of checks. Liveness should only contain checks where a restart fixes the problem. Dependency failures belong on readiness. See Kubernetes Probes for detailed guidance.

Check-Specific Configuration

'checks_config' => [
    'database'    => ['connection' => null],
    'cache'       => ['store' => null],
    'queue'       => ['connection' => null],
    'storage'     => ['disk' => 'local'],
    'redis'       => ['connection' => 'default'],
    'environment' => ['required' => []],
    'schedule'    => ['max_age_minutes' => 5],
],

null values use the Laravel default connection/store.

Metrics

'metrics' => [
    'prometheus' => [
        'enabled' => env('HEALTH_PROMETHEUS_ENABLED', true),
        'namespace' => env('HEALTH_PROMETHEUS_NAMESPACE', 'app'),
    ],
    'system' => [
        'memory'  => true,
        'load'    => true,
        'storage' => true,
        'network' => true,
    ],
],

The namespace prefixes all Prometheus metric names (e.g. app_health_check_status).

Thresholds

'thresholds' => [
    'disk_space_percent' => 90,
    'memory_percent'     => 90,
    'cpu_load_per_core'  => 2.0,
],

Checks report critical when these thresholds are exceeded.

Caching

'cache' => [
    'enabled' => env('HEALTH_CACHE_ENABLED', true),
    'ttl'     => env('HEALTH_CACHE_TTL', 10),
    'store'   => null,
],

See Caching for details.

Environment Variables

Variable Default Description
HEALTH_ENABLED true Enable/disable all endpoints
HEALTH_PREFIX health URL prefix for all endpoints
HEALTH_TOKEN null Bearer token for authentication
HEALTH_ALLOWED_IPS null Comma-separated IP allowlist
HEALTH_CACHE_ENABLED true Enable response caching
HEALTH_CACHE_TTL 10 Cache TTL in seconds
HEALTH_PROMETHEUS_ENABLED true Enable Prometheus metrics
HEALTH_PROMETHEUS_NAMESPACE app Prometheus metric name prefix