postalservice14 / php-actuator-silex-provider
Silex Provider for php-actuator
1.0.0
2016-02-17 22:15 UTC
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-09-15 23:54:20 UTC
README
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();
- 运行服务
php -S localhost:8000 -t public public/index.php
- 访问 http://localhost:8000/health 查看您的健康指标。
示例
在 /example 中提供
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
测试
$ composer test
贡献
请参阅 CONTRIBUTING 和 CONDUCT 了解详细信息。
鸣谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。