Download the PHP package lgarret/health-check-bundle without Composer
On this page you can find all versions of the php package lgarret/health-check-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package health-check-bundle
HealthCheckBundle
A Symfony bundle providing a /health endpoint to monitor your application and its dependencies.
Installation
Register the bundle
Import routes
Allow public access
If you use the Symfony SecurityBundle, make sure the health route is publicly accessible:
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
path |
string |
/health |
URL path for the health check endpoint. |
secret |
string? |
null |
Token expected in the configured header. If null, details are never exposed. |
header |
string |
Authorization |
Name of the HTTP header used to send the secret token. |
timeout |
int |
5 |
Maximum execution time in seconds for each individual check. |
cache.enabled |
bool |
true |
Enable caching of health check results. |
cache.ttl |
int |
300 |
Cache TTL in seconds (5 minutes by default). |
checks.doctrine |
bool |
true |
Auto-register Doctrine DBAL checks (one per connection) if doctrine/dbal is installed. |
checks.asset_mapper |
bool |
true |
Auto-register AssetMapper check if symfony/asset-mapper is installed. |
Usage
GET /health
Without auth header (or without a configured secret):
With a valid auth header:
Console command
Run checks from the command line:
Built-in checks
The bundle ships with built-in checks that are automatically registered when the corresponding packages are installed:
| Check | Package required | What it does |
|---|---|---|
doctrine |
doctrine/dbal |
Runs SELECT 1 on each configured DBAL connection |
asset_mapper |
symfony/asset-mapper |
Checks that manifest.json exists (assets compiled) |
Built-in checks are enabled by default and auto-detected via class_exists() and service availability. One check is registered per Doctrine connection (e.g. doctrine_default, doctrine_analytics). The asset mapper check verifies that public/assets/manifest.json exists (i.e. asset-map:compile has been run). You can disable them in your configuration:
Creating a custom check
Implement HealthCheckInterface — the service will be automatically discovered and registered:
Querying a remote health check endpoint
HealthCheckClient lets you query the /health endpoint of another Symfony application (e.g. a different site running this same bundle) and get back a typed result instead of raw JSON. It requires symfony/http-client:
HealthCheckClient::check() returns a RemoteHealthCheckResult:
| Property | Type | Description |
|---|---|---|
reachable |
bool |
false if the request failed at the network level or the response couldn't be parsed |
report |
?HealthCheckReport |
The remote health report (status + checks), present only when reachable is true |
error |
?string |
Error message, present only when reachable is false |
If no secret (or an empty string) is provided, the remote endpoint will only return its global status (no checks detail), matching the unauthenticated response documented above.
HealthCheckClient is only registered as a service when symfony/http-client is installed (auto-detected, like the built-in checks). If it isn't installed, autowiring HealthCheckClient fails with Symfony's standard "service not found" error at compile time, rather than a runtime exception.
Flex recipe
Sample configuration files are available in the recipe/ directory for use with Symfony Flex.
Development
License
MIT
All versions of health-check-bundle with dependencies
symfony/cache Version ^6.4 || ^7.0 || ^8.0
symfony/console Version ^6.4 || ^7.0 || ^8.0
symfony/framework-bundle Version ^6.4 || ^7.0 || ^8.0
symfony/http-client-contracts Version ^3.5