postalservice14 / php-actuator-silex-provider
Silex Provider for php-actuator
Installs: 27 353
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ~5.5|~7.0
- postalservice14/php-actuator: ^1.0
- silex/silex: ^1.3
Requires (Dev)
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-12-16 00:17:32 UTC
README
Silex Provider for php-actuator
Install
Via Composer
$ composer require postalservice14/php-actuator-silex-provider
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
$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"):
GET /health
: Get health indicator statuses
Getting Started
The following is a minimal example to get you started quickly. It uses the DiskSpaceHealthIndicator.
- 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
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Credits
License
The MIT License (MIT). Please see License File for more information.