PHPackages                             tourze/psr15-health-check-request-handler - 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. tourze/psr15-health-check-request-handler

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

tourze/psr15-health-check-request-handler
=========================================

PSR-15 Health Check Request Handler

0.0.1(1y ago)09MITPHPPHP ^8.1CI passing

Since Apr 24Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/psr15-health-check-request-handler)[ Packagist](https://packagist.org/packages/tourze/psr15-health-check-request-handler)[ RSS](/packages/tourze-psr15-health-check-request-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

PSR-15 Health Check Request Handler
===================================

[](#psr-15-health-check-request-handler)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/0568bfb786533c57b2145e83395405bd2cd80ef49fbe6d2edf2c80360337bf9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f70737231352d6865616c74682d636865636b2d726571756573742d68616e646c65722e737667)](https://packagist.org/packages/tourze/psr15-health-check-request-handler)[![PHP Version Require](https://camo.githubusercontent.com/649b8395f4fa124833a7211905c66e4de773d2d8359d99096ca1d60a293d9b99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f70737231352d6865616c74682d636865636b2d726571756573742d68616e646c65722e737667)](https://packagist.org/packages/tourze/psr15-health-check-request-handler)[![codecov](https://camo.githubusercontent.com/1faff482c74f0c20fb4ecb7282ca44b93a4474b2547e2eec20e27a0ea31cc4e2/68747470733a2f2f636f6465636f762e696f2f67682f746f75727a652f70737231352d6865616c74682d636865636b2d726571756573742d68616e646c65722f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/tourze/psr15-health-check-request-handler)[![License](https://camo.githubusercontent.com/545f09b6d89745ad0232cb14bb81fe617ba13239665846fb2e20140d70dbb011/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f746f75727a652f70737231352d6865616c74682d636865636b2d726571756573742d68616e646c65722e737667)](./LICENSE)

A simple and lightweight PSR-15 Request Handler for health check endpoints, designed for easy integration into any HTTP service or middleware pipeline.

Features
--------

[](#features)

- Implements PSR-15 `RequestHandlerInterface`
- Provides a basic health check endpoint, returning HTTP 200 with a customizable response
- Supports custom health check paths
- Customizable response body for healthy status
- Returns HTTP 404 for non-health-check paths

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

[](#installation)

**Requirements:**

- PHP &gt;= 8.1
- `psr/http-message`, `psr/http-server-handler`, `nyholm/psr7`

Install via Composer:

```
composer require tourze/psr15-health-check-request-handler
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use Tourze\PSR15HealthCheckRequestHandler\HealthCheckRequestHandler;

$handler = new HealthCheckRequestHandler();
$response = $handler->handle($request); // $request must implement ServerRequestInterface
```

### Default Behavior

[](#default-behavior)

By default, the handler responds with status 200 and body `ok` for the following paths:

- `/health`
- `/health.php`
- `/health.html`
- `/health.asp`

All other paths will receive a 404 Not Found response.

### Customization

[](#customization)

You can customize the health check paths and healthy response text (using reflection):

```
use ReflectionProperty;
use Tourze\PSR15HealthCheckRequestHandler\HealthCheckRequestHandler;

$handler = new HealthCheckRequestHandler();

// Change health check paths
$pathsProperty = new ReflectionProperty(HealthCheckRequestHandler::class, 'healthCheckPaths');
$pathsProperty->setAccessible(true);
$pathsProperty->setValue($handler, ['/custom-health']);

// Change healthy response text
$okTextProperty = new ReflectionProperty(HealthCheckRequestHandler::class, 'okText');
$okTextProperty->setAccessible(true);
$okTextProperty->setValue($handler, 'service is healthy');
```

Documentation
-------------

[](#documentation)

- [PSR-15: HTTP Server Request Handlers](https://www.php-fig.org/psr/psr-15/)
- The handler only checks the request path and does not implement any advanced health logic.

Contributing
------------

[](#contributing)

- Issues and pull requests are welcome.
- Please follow PSR coding standards.
- Run tests with PHPUnit before submitting PRs.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

Changelog
---------

[](#changelog)

See [Releases](https://github.com/tourze/psr15-health-check-request-handler/releases) for version history and upgrade notes.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance62

Regular maintenance activity

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Unknown

Total

1

Last Release

383d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-psr15-health-check-request-handler/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-psr15-health-check-request-handler/health.svg)](https://phpackages.com/packages/tourze-psr15-health-check-request-handler)
```

###  Alternatives

[bref/bref

Bref is a framework to write and deploy serverless PHP applications on AWS Lambda.

3.4k9.6M55](/packages/bref-bref)[aimeos/aimeos-base

Aimeos base layer for abstracting from host environments

2.1k134.0k1](/packages/aimeos-aimeos-base)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[fisharebest/webtrees

webtrees online genealogy

73710.5k13](/packages/fisharebest-webtrees)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[oat-sa/lib-lti1p3-core

OAT LTI 1.3 Core Library

36341.9k10](/packages/oat-sa-lib-lti1p3-core)

PHPackages © 2026

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