PHPackages                             cms-health-project/serializable-reference-implementation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cms-health-project/serializable-reference-implementation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cms-health-project/serializable-reference-implementation
========================================================

Reference implementation of the CMS HealthCheck RFC using the \\JsonSerializable interface.

0.0.5(1y ago)1932MITPHPPHP ^8.1CI passing

Since Mar 15Pushed 1y ago3 watchersCompare

[ Source](https://github.com/cms-health-project/serializable-reference-implementation)[ Packagist](https://packagist.org/packages/cms-health-project/serializable-reference-implementation)[ RSS](/packages/cms-health-project-serializable-reference-implementation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (7)Used By (2)

Reference implementation of the CMS HealthCheck RFC using `\JsonSerializable` interface
=======================================================================================

[](#reference-implementation-of-the-cms-healthcheck-rfc-using-jsonserializable-interface)

Introduction
------------

[](#introduction)

This library provides an example reference implementation of the [CMS HealthCheck RFC](https://github.com/cms-health-project/health-check-rfc)using the `\JsonSerializable` interface to avoid the usage of a dedicated formatter or builder as it is integrated into the classes directly.

Maintainer
----------

[](#maintainer)

This package has been created and is maintained by [Stefan Bürk ](https://github.com/sbuerk).

Installation
------------

[](#installation)

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

```
conmposer require "cms-health-project/serializable-reference-implementation"

```

Usage
-----

[](#usage)

Build up the result structure:

```
$time = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:sP', '2024-03-19T01:23:45+00:00');
$check1 = new Check('package:check-one');
$check1->addCheckResults(
    new CheckResult(
        'check1-component1',
        'system',
        CheckResultStatus::Pass,
        $time,
    ),
);
$check2 = new Check('package:check-two');
$check2->addCheckResults(
    new CheckResult(
        'check2-component1',
        'system',
        CheckResultStatus::Fail,
        $time,
        'observed-value',
        'with-unit',
        'and-output'
    ),
);
$checks = new CheckCollection();
$checks->addCheck($check1, $check2);
$healthCheck = new HealthCheck(
    HealthCheckStatus::Fail,
    '1',
    'service-id',
    'description',
    $checks,
);
```

and than simply use `json_encode()` to create the json:

```
$json = \json_encode($healthCheck, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
```

and you get the json, for example:

```
{
    "status": "fail",
    "version": "1",
    "serviceId": "service-id",
    "description": "description",
    "checks": {
        "package:check-one": [
            {
                "componentId": "check1-component1",
                "componentType": "system",
                "status": "pass",
                "time": "2024-03-19T01:23:45+00:00"
            }
        ],
        "package:check-two": [
            {
                "componentId": "check2-component1",
                "componentType": "system",
                "status": "fail",
                "time": "2024-03-19T01:23:45+00:00",
                "output": "and-output",
                "observedValue": "observed-value",
                "observedUnit": "with-unit"
            }
        ]
    }
}
```

Contribution
------------

[](#contribution)

This package contains for now only a cgl check based on `php-cs-fixer`.

```
composer install
composer cgl:fix

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance45

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22ea8c0796de498c0d81554f12539e71bdb9b9359df3a82a7fb450867a68a680?d=identicon)[sbuerk](/maintainers/sbuerk)

---

Top Contributors

[![o-ba](https://avatars.githubusercontent.com/u/8812114?v=4)](https://github.com/o-ba "o-ba (8 commits)")[![burned42](https://avatars.githubusercontent.com/u/16883833?v=4)](https://github.com/burned42 "burned42 (6 commits)")[![sbuerk](https://avatars.githubusercontent.com/u/1453466?v=4)](https://github.com/sbuerk "sbuerk (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cms-health-project-serializable-reference-implementation/health.svg)

```
[![Health](https://phpackages.com/badges/cms-health-project-serializable-reference-implementation/health.svg)](https://phpackages.com/packages/cms-health-project-serializable-reference-implementation)
```

###  Alternatives

[tareq1988/wordpress-settings-api-class

WordPress settings API Abstraction Class

46611.1k3](/packages/tareq1988-wordpress-settings-api-class)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
