postalservice14/php-actuator-silex-provider

Silex Provider for php-actuator

1.0.0 2016-02-17 22:15 UTC

This package is auto-updated.

Last update: 2024-10-16 00:00:58 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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();

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.