Serves functionality of healthchecks of your application
chocofamilyme/laravel-healthcheck is a Laravel package for serves functionality of healthchecks of your application.
It currently has 11 GitHub stars and 131.729 downloads on Packagist (latest version 4.0.0).
Install it with composer require chocofamilyme/laravel-healthcheck.
Discover more Laravel packages by chocofamilyme
or browse all Laravel packages to compare alternatives.
Last updated
Health Check library adds new endpoints(routes) to your project which are used to check some services of your application. For example you want to check "Database Connection" of your microservice.
composer require chocofamilyme/laravel-healthcheck ^2.0
php artisan vendor:publish --provider="Chocofamilyme\LaravelHealthCheck\Providers\HealthCheckServiceProvider"
{
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
{
"DB": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
},
"CACHE": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
},
"SESSIONS": {
"STATUS": "CRITICAL",
"STATUS_BOOL": false,
"MESSAGE": "Connection to tarantool.example.com failed"
},
"STORAGE": {
"STATUS": "OK",
"STATUS_BOOL": true,
"MESSAGE": null
}
}
Create a class which implements Chocofamilyme\LaravelHealthCheck\Services\Checks\ComponentCheckInterface and add it to healthcheck.php config file like
return [
'componentChecks' => [
'YOURCUSTOMCHECK' => YourCustomCheck::class
]
]
There is a configuration param which describes which response class to use to output the response. For example
{
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
{
"data": {
"DB": "OK",
"CACHE": "OK",
"SESSIONS": "CRITICAL",
"STORAGE": "OK"
}
}
Feel free to add your responses, if you want for example to output it in a view instead json.