Introduction
Introduction
Laravel Health provides production-ready health monitoring for Laravel applications. It ships with Kubernetes probe endpoints, Prometheus-compatible metrics, and 11 built-in health checks — all configurable from a single config file.
Features
- Kubernetes Probes — liveness, readiness, and startup endpoints
- Prometheus Metrics — OpenMetrics-compatible
/health/metrics - JSON Metrics — structured system metrics API
- HTML Dashboard — optional real-time status UI
- 11 Built-in Checks — database, cache, queue, storage, Redis, environment, schedule, CPU, memory, disk space
- Custom Checks — implement the
HealthCheckcontract - Token & IP Auth — protect endpoints with bearer tokens and IP allowlists
- Response Caching — configurable TTL to reduce overhead
- Container Awareness — automatic cgroup detection for Docker/Kubernetes
How It Works
The package registers health check endpoints under a configurable prefix (default: /health). Each endpoint runs its own set of checks and returns:
200— all checks pass503— one or more checks fail
You assign checks to probes based on their purpose:
- Liveness (
/health) — is the process stuck? Failure triggers a container restart. Keep this minimal — typically just the database. - Readiness (
/health/ready) — can this pod serve traffic? Failure removes the pod from the load balancer but keeps it running. Include all dependencies here. - Startup (
/health/startup) — has the app finished booting? Runs once.
This distinction matters. A Redis check on liveness means a Redis outage restarts all your pods — turning a dependency blip into a full application outage. See Kubernetes Probes for detailed guidance.