定制 cms-health-project/psr15-implementation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cms-health-project/psr15-implementation

最新稳定版本:0.0.3

Composer 安装命令:

composer require cms-health-project/psr15-implementation

包简介

PSR-15 implementation of the CMS HealthCheck RFC.

README 文档

README

Introduction

To have a PSR-15 compatible request handler for the CMS health check RFC this repo is built using eqsgroup/health-check-provider as a base but using cms-health-project/serializable-reference-implementation for the actual implementation of the output schema which got slightly adjusted from the original RFC.

This was created during CloudFest Hackathon 2025.

Installation

To use this library in your project or library, require it with:

composer require "cms-health-project/psr15-implementation"

Usage

To use this in your application, you'd typically register a new route like e.g. GET /health which can then use the RequestHandler to process the request.

To configure your health checks you have two options. You can pass instances of HealthCheckerInterface directly to the constructor of RequestHandler. It also accepts a PSR-14 Event Dispatcher which allows you to register some event listeners/subscribers that react to the CollectHealthCheckResultsEvent.

$checks = [
    new CallableHealthChecker(
        'callable:responseTime',
        fn () => true,
        'your-component-id',
        'your-component-type',
        500,
    ),
    new DoctrineConnectionHealthChecker(
        $connection,
    ),
    new HttpHealthChecker(
        'http:request',
        new Client(),
        new Request('GET', '/some/endpoint'),
    ),
];

$handler = new RequestHandler(
    new ResponseFactory(),
    new StreamFactory(),
    'your-service-id',
    'your-service-description',
    $checks,
    eventDispatcher: $eventDispatcher,
);

$response = $handler->handle($request);

Take a look at the tests for more usage examples.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固