Download the PHP package cego/service-health-checking without Composer
On this page you can find all versions of the php package cego/service-health-checking. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cego/service-health-checking
More information about cego/service-health-checking
Files in cego/service-health-checking
Package service-health-checking
Short Description A package containing a generic health check endpoint designed with expansion in mind
License MIT
Informations about the package service-health-checking
Service Health Checking
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:
The checks array contains an entry for each registered health check.
Authorization
The endpoints run the middleware stack from config('service-health-checking.middleware'),
which is empty by default — they are polled by monitoring, not a browser, so they carry no
session and no authorization gate.
To restrict who may poll them, publish the config (see below) and add middleware:
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:
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. A published config replaces the default registry entirely. A registry entry
that cannot be resolved is reported as a failing check.
Bundled health checks
| Check | Default registry | Purpose |
|---|---|---|
DefaultDatabaseConnectionCheck |
registered | Checks that a connection to the default database can be established |
CacheCheck |
opt-in | Checks read/write access to the cache |
Upgrading to 2.0
ActiveRequestInsurancesCheck,FailedRequestInsurancesCheckandServiceHealthConfigCheckhave been removed. Remove them, and therequest-insurancesection, from your publishedconfig/service-health-checking.php.CacheCheckis no longer registered by default. Add it to your registry if you want to keep running it.
All versions of service-health-checking with dependencies
illuminate/http Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
ext-json Version *