eqs/health-check-provider
Composer 安装命令:
composer require eqs/health-check-provider
包简介
Provides healthcheck endpoints in accordance with IETF's healthcheck draft RFC
README 文档
README
Provides structure for healthcheck endpoints in accordance with IETF's healthcheck draft RFC
About
Package provides endpoints which conform to draft 06 version of IETF's healthcheck RFC.
Integrations
We are shipping following integrations, but it's very easy to implement your own by reusing CallableHealthChecker:
- HTTP request
- Doctrine Connection
Installation
Install this package as a dependency using Composer.
composer require eqs/health-check-provider
Usage
This library provides PSR-15 HTTP Server Request Handler, which guarantees compatibility with wide range of PHP frameworks. In case your framework does not natively support it, you can find a PSR bridge which supports it.
Example controller for Symfony framework
For this example, on top of standard symfony packages, you also need php-http/discovery and symfony/psr-http-message-bridge packages.
use Doctrine\DBAL\Connection; use GuzzleHttp\Psr7\HttpFactory; use EQS\HealthCheckProvider\DTO\CheckDetails; use EQS\HealthCheckProvider\DTO\HealthResponse; use EQS\HealthCheckProvider\HealthChecker\CallableHealthChecker; use EQS\HealthCheckProvider\HealthChecker\DoctrineConnectionHealthChecker; use EQS\HealthCheckProvider\HealthChecker\HttpHealthChecker; use EQS\HealthCheckProvider\RequestHandler; use Psr\Http\Client\ClientInterface; use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Messenger\Transport\Receiver\MessageCountAwareInterface; use Symfony\Component\Messenger\Transport\TransportInterface; use Symfony\Component\Routing\Annotation\Route; class GetHealthCheckController extends AbstractController { public function __construct( #[Autowire(service: 'messenger.transport.amqp_dc_user_update')] private MessageCountAwareInterface&TransportInterface $transport, private Connection $connection, private ClientInterface $httpClient, ) {} #[Route(path: '/api/health_check')] public function __invoke(Request $request): Response { $psr17Factory = new HttpFactory(); $psrBridge = new HttpFoundationFactory(); return $psrBridge->createResponse( (new RequestHandler( new HealthResponse(), [ new CallableHealthChecker(new CheckDetails('AMQP', true), fn () => $this->transport->getMessageCount()), new DoctrineConnectionHealthChecker(new CheckDetails('Database', true), $this->connection), new HttpHealthChecker( new CheckDetails('External API', false), $this->httpClient, new \GuzzleHttp\Psr7\Request('GET', 'https://www.google.com'), ), ], $psr17Factory, $psr17Factory, )) ->handle((new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory)) ->createRequest($request)), ); } }
Contributing
Contributions are welcome! To contribute, please familiarize yourself with CONTRIBUTING.md.
Copyright and License
eqs/health-check-provider is copyright © EQS Group and licensed for use under the terms of the MIT License (MIT). Please see LICENSE for more information.
eqs/health-check-provider 适用场景与选型建议
eqs/health-check-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.87k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2024 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「health」 「psr-15」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eqs/health-check-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eqs/health-check-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eqs/health-check-provider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Is your Laravel app OK? Health checks running in production to ensure you can sleep well at night and be sure everything is still OK.
Provide status and health api endpoints
SoftWax Health Check Bundle for Symfony framework
Laravel Server & App Health Monitor and Notifier
Health checks, Kubernetes probes, Prometheus metrics, and system monitoring for Laravel
Kanbino Health endpoint for Laravel — emits stack profile + extensible probes for uptime + security advisory matching
统计信息
- 总下载量: 12.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-09