Download the PHP package gritzkoo/php-health-checker without Composer
On this page you can find all versions of the php package gritzkoo/php-health-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gritzkoo/php-health-checker
More information about gritzkoo/php-health-checker
Files in gritzkoo/php-health-checker
Package php-health-checker
Short Description Simple package to health-check
License MIT
Informations about the package php-health-checker
PHP Health Checker
This is a PHP package that allows you to track the health of your application, providing two methods of checking $checkt->liveness()
and $checker->readiness()
:
How to install
Bootstrapping the checker
Example of use
You can view this full Laravel application, with this package installed in:
https://github.com/gritzkoo/php-health-checker-example-app
$checker->liveness()
Will return an ARRAY that you can convert to JSON as below and that allows you to check if your application is OK without checking any kind of integration.
$checker->readiness()
Will return an ARRAY that you can convert to JSON as below and that allows you to check if your application is up and running and check if all of your integrations informed in the configuration list are up and running.
Create a HTTP inteface to expose probs
Using Laravel application example https://github.com/gritzkoo/php-health-checker-example-app
Once you create an instance of Gritzkoo\HealthChecker\HealthChecker
you should create 2 routes in your application to expose liveness
and readiness
actions like:
- Controller https://github.com/gritzkoo/php-health-checker-example-app/blob/main/app/Http/Controllers/HealthCheckController.php#L10-L22
- Route https://github.com/gritzkoo/php-health-checker-example-app/blob/main/routes/web.php#L20-L22
And then, you could call these endpoints manually to see your application health, but, if you are using modern Kubernetes deployment, you can config your chart to check your application with the setup below: