PHPackages                             ez-php/health - 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. [Framework](/categories/framework)
4. /
5. ez-php/health

ActiveLibrary[Framework](/categories/framework)

ez-php/health
=============

Lightweight health-check endpoint for the ez-php framework — DB, Redis, and Queue probes with a JSON /health response

1.11.1(1mo ago)00MITPHPPHP ^8.5CI passing

Since Mar 28Pushed todayCompare

[ Source](https://github.com/ez-php/health)[ Packagist](https://packagist.org/packages/ez-php/health)[ Docs](https://github.com/ez-php/health)[ RSS](/packages/ez-php-health/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (22)Used By (0)

ez-php/health
=============

[](#ez-phphealth)

Lightweight health-check endpoint for the ez-php framework.

Registers a `GET /health` route that runs configurable probes (database, Redis, queue) and returns a JSON report. Independently registrable via `HealthServiceProvider` — no additional route configuration required.

---

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

[](#installation)

```
composer require ez-php/health
```

Add the provider to `provider/modules.php`:

```
\EzPhp\Health\HealthServiceProvider::class,
```

The `/health` endpoint is now live.

---

Response format
---------------

[](#response-format)

**HTTP 200** — all probes healthy:

```
{
  "status": "ok",
  "probes": {
    "database": { "status": "ok", "message": "connected", "latency_ms": 1.23 },
    "redis":    { "status": "ok", "message": "connected", "latency_ms": 0.45 },
    "queue":    { "status": "ok", "message": "3 pending job(s)", "latency_ms": 0.89 }
  }
}
```

**HTTP 503** — one or more probes degraded or unhealthy:

```
{
  "status": "degraded",
  "probes": {
    "database": { "status": "ok",       "message": "connected",       "latency_ms": 1.10 },
    "redis":    { "status": "degraded", "message": "slow response",    "latency_ms": 310.00 },
    "queue":    { "status": "ok",       "message": "0 pending job(s)", "latency_ms": 0.70 }
  }
}
```

### Status levels

[](#status-levels)

StatusMeaningHTTP`ok`All probes passed200`degraded`At least one probe is impaired but not critical503`unhealthy`At least one probe failed completely503---

Built-in probes
---------------

[](#built-in-probes)

ProbeTrigger conditionWhat it checks`DatabaseProbe``DatabaseInterface` bound in container`SELECT 1` on the configured PDO`RedisProbe``health.redis.host` config key present`PING` on the Redis server`QueueProbe``DatabaseInterface` bound in container`SELECT COUNT(*) FROM jobs`Probes that cannot be set up (missing binding, missing extension) are silently skipped — the endpoint still works with whatever probes are available.

---

Configuration
-------------

[](#configuration)

Add to `config/health.php` (only needed for the Redis probe):

```
