postalservice14/php-actuator-silex-provider

1.0.0 2016-02-17 22:15 UTC

This package is auto-updated.

Last update: 2024-09-15 23:54:20 UTC


README

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

Silex Provider for php-actuator

安装

通过 Composer

$ composer require postalservice14/php-actuator-silex-provider

参数

  • health.indicators: 要使用的指标数组。键为指标名称,值为指标对象。
  • health.endpoint: 健康检查的端点。默认为 "/health"。

注册

$app->register(new Actuator\Silex\Provider\HealthServiceProvider(), array(
    "health.indicators" => array(
        new DiskSpaceHealthIndicator()
    )
));

用法

以下路由默认提供(除非您更改了 "health.endpoint")

  • GET /health: 获取健康指标状态

入门

以下是一个快速入门的示例。它使用了 DiskSpaceHealthIndicator

  • 创建一个 composer.json,至少包含以下依赖项
{
    "require": {
        "postalservice/php-actuator": "^1.0"
    }
}
  • 运行 composer install
  • 创建 /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 中提供

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

测试

$ composer test

贡献

请参阅 CONTRIBUTINGCONDUCT 了解详细信息。

鸣谢

许可

MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。