tseguier / health-check
A bundle that provides a healtcheck route, with an extendable interface for your own checkers services.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 420
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 8
Type:symfony-bundle
Requires
- php: >=7.1
- symfony/config: ^4.1
- symfony/dependency-injection: ^4.1
- symfony/http-foundation: ^4.1
- symfony/http-kernel: ^4.1
- symfony/routing: ^4.1
- zircote/swagger-php: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- phpmd/phpmd: ^2.6
- phpstan/phpstan: ^0.11.12
- phpstan/phpstan-strict-rules: ^0.11.1
- phpstan/phpstan-symfony: ^0.11.6
- phpunit/phpunit: ^8.2
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2019-09-23 11:58:20 UTC
README
A controller which checks all the containers implementing HealthCheckInterface
.
It will call the checkHealth
method of each and will display a JSON output:
{
"status": true if all containers returned a HealthData
with status true, false else.
"timestamp": actual date
}
Installation
Install with composer:
composer require tseguier/health-check
Add the bundle to your bundles.php
Tseguier\HealthCheckBundle\HealthCheckBundle::class => ['all' => true],
Configure the controller route in your routes.yaml
health_check:
resource: "@HealthCheckBundle/Controller/HealthCheckController.php"
prefix: /
type: annotation
Configuration
The timestamp format can be configured in the date_format
configuration field, default is 'Y-m-d H:i:s T'
Health Checker Services
To check the health of a service you just need to implements HealthCheckInterface
into it.
e.g. :
use Tseguier\HealthCheckBundle\Dto\HealthData;
use Tseguier\HealthCheckBundle\HealthCheckInterface;
final class HealthCheckerService implements HealthCheckInterface
{
public function checkHealth(): HealthData
{
if ($this->somethingToCheck->isWorking()) {
return new HealthData(true);
} else {
return new HealthData(false);
}
}
}
Next Release
- additional data on checked services
- route for detailled informations