cego / service-health-checking
A package containing a generic health check endpoint designed with expansion in mind
Requires
- php: ^7.4|^8.0
- ext-json: *
- illuminate/http: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- cego/php-cs-fixer: ^2.0.0
- cego/phpstan: ^4.0.0
- cego/request-insurance: ^3.0.0
- orchestra/testbench: ^10.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-06-08 10:09:50 UTC
README
This package contains core functionality for HTTP health checking of Laravel services.
Usage
When the package is installed, a health endpoint, /vendor/service-health-checking is exposed. The endpoint
returns 200 OK and a body with a JSON data object with the following format:
{
"status": "pass|warn|fail",
"checks": [
{
"status": "pass|warn|fail",
"name": "HealthCheckClassName",
"description": "Description defined in the health check class",
"message": "Message set in the HealthStatus object"
}
]
}
The checks array contains an entry for each registered health check.
Creating health checks
To create a health check for your service, simply create a class that extends
\Cego\ServiceHealthChecking\BaseHealthCheck. The base method has 2 abstract methods:
check(): HealthStatusshould perform the check and return aHealthStatusobject.getDescription(): stringshould return a description of the health check.
Registering health checks
Firstly, publish the package assets by running:
php artisan vendor:publish --provider="Cego\ServiceHealthChecking\ServiceHealthCheckingServiceProvider"
The package will publish a config file, service-health-checking.php, in which health check classes must be
registered, in order for them to run. The package is shipped with a basic database connection check, which is registered
by default.