PHPackages                             intrepidity/healthcheck - 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. intrepidity/healthcheck

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

intrepidity/healthcheck
=======================

Library to simplify writing health checks for external dependencies of your application

1.1.0(7y ago)04PHPPHP &gt;=7.2.0

Since Dec 29Pushed 7y agoCompare

[ Source](https://github.com/Intrepidity/healthcheck)[ Packagist](https://packagist.org/packages/intrepidity/healthcheck)[ RSS](/packages/intrepidity-healthcheck/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)Dependencies (9)Versions (11)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e71ce80a998698c43e8ebd5309cf59ca84b8cc5b79614c7a7a4515a46ed1560b/68747470733a2f2f7472617669732d63692e6f72672f496e7472657069646974792f6865616c7468636865636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Intrepidity/healthcheck)

Warning: This is a library in development, and probably not production ready. Here still be some tiny dragons.

Health check
============

[](#health-check)

In order to quickly diagnose problems in your applications it's important to be able to quickly distinguish between problems in the application itself, and it's dependencies.

Modern applications often have multiple layers of dependencies. For example, your application uses an API, and that API consumes a MySQL database. Downtime on that database will almost certainly affect your application 2 levels up in the chain.

In order to deal with this we need effective health checks. This allows us to quickly spot that our dependency `authentication_api` (for example) has become unhealthy, and the health status of that API then indicates it's MySQL dependency has left the building.

This library aims to make dealing with health checks a little bit easier.

Usage
-----

[](#usage)

A health check consists of an instance of `HealthService`, containing one or more instances of `HealthCheckInterface`. A health check is checking a single dependency, and the health service instance then reports on the collection as a whole.

For example, we can initialize and execute a set of checks like so:

```
$healthCheck = HealthService([
   new PdoCheck("dsn", "username", "password"),
   new HttpStatusCheck($httpClient, $requestFactory, new Uri("http://my-endpoint"), [200])
]);

$report = $healthCheck->performAll();

```

The report variable then contains an object with all the check results, plus some higher level summary information.

This library comes out of the box with a simple HTTP Status check and PDO connection check, other checks have to be implemented manually.

This library heavily relies on PSR-7, PSR-17 and PSR-18 standards, so it is often assumed that you supply your own implementations of PSR interfaces, such as request- and response factories.

Recommendations
---------------

[](#recommendations)

### Labels

[](#labels)

The label property for each check should be reflective of the name of the application being checked.

For example, my main application could have a health check labelled `authentication_api`, which can then lead to some montitoring system firing a query at that particular application to determine which of it's dependencies has become unhealthy, and so forth. This way an almost automatic map of service health can be generated within your organization.

### Exposing health checks

[](#exposing-health-checks)

Health checks should be exposed on a URL so that external services and monitoring systems can access them. It is recommended however to keep the health endpoints exposed only inside of your network.

The `ResponseFactory` class can be used to easily create a PSR-7 response for use in your health endpoints, like so:

```
$factory = new ResponseFactory(
    $psrResponseFacory,
    $streamFactory,
    $healthService
);

$response = $factory->create();

```

Todo's
------

[](#todos)

The following features are still in progress

- PSR middleware to expose health information
- More standard health checks

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

9

Last Release

2692d ago

Major Versions

0.3.0 → 1.0.02018-12-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/97156c5d29540010698f984d1971607b066d8fc61671c1a6caba25a587a96ef9?d=identicon)[Intrepidity](/maintainers/Intrepidity)

---

Top Contributors

[![Intrepidity](https://avatars.githubusercontent.com/u/1059872?v=4)](https://github.com/Intrepidity "Intrepidity (32 commits)")

---

Tags

healthhealthcheckmicroservicesphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/intrepidity-healthcheck/health.svg)

```
[![Health](https://phpackages.com/badges/intrepidity-healthcheck/health.svg)](https://phpackages.com/packages/intrepidity-healthcheck)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)

PHPackages © 2026

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