php-actuator-silex-provider
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
Silex Provider for php-actuator, (*2)
Install
Via Composer, (*3)
``` bash
$ composer require postalservice14/php-actuator-silex-provider, (*4)
## Parameters
* **health.indicators**: An array of indicators to be used. Key as indicator name, value as indicator object.
* **health.endpoint**: Endpoint for health checks. Defaults to "/health".
## Registering
```php
$app->register(new Actuator\Silex\Provider\HealthServiceProvider(), array(
"health.indicators" => array(
new DiskSpaceHealthIndicator()
)
));
Usage
The following route is made available by default (unless you changed the "health.endpoint"):, (*5)
-
GET /health: Get health indicator statuses
Getting Started
The following is a minimal example to get you started quickly. It uses the
DiskSpaceHealthIndicator., (*6)
- Create a composer.json with at minimum, the following dependecies
{
"require": {
"postalservice/php-actuator": "^1.0"
}
}
- Run composer install
- Create /public/index.php
require_once __DIR__.'/../vendor/autoload.php';
use Silex\Application;
use Actuator\Health\Indicator\DiskSpaceHealthIndicator;
use Actuator\Health\Indicator\DoctrineConnectionHealthIndicator;
use Doctrine\DBAL\DriverManager;
$app = new Application();
$app['debug'] = true;
$app->register(new Actuator\Silex\Provider\HealthServiceProvider(), array(
"health.indicators" => array(
'diskspace' => new DiskSpaceHealthIndicator()
)
));
$app->run();
- Run the service
php -S localhost:8000 -t public public/index.php
- Go to http://localhost:8000/health to see your health indicator.
Example
Available at /example, (*7)
Change log
Please see CHANGELOG for more information what has changed recently., (*8)
Testing
bash
$ composer test, (*9)
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*10)
Credits
License
The MIT License (MIT). Please see License File for more information., (*11)