PHPackages                             mehr-it/eli-middleware-chain - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. mehr-it/eli-middleware-chain

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

mehr-it/eli-middleware-chain
============================

Chaining for PSR-15 middleware

1.0.1(6y ago)04MITPHPPHP &gt;=7.1.0CI failing

Since Jan 8Pushed 6y agoCompare

[ Source](https://github.com/mehr-it/eli-middleware-chain)[ Packagist](https://packagist.org/packages/mehr-it/eli-middleware-chain)[ RSS](/packages/mehr-it-eli-middleware-chain/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (3)Used By (0)

PSR middleware chain
====================

[](#psr-middleware-chain)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8fdc982c4ba7a4a35809a79ab07970d78e23ffb9737c4045a26d60cb15a88412/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6568722d69742f656c692d6d6964646c65776172652d636861696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mehr-it/eli-middleware-chain)[![Build Status](https://camo.githubusercontent.com/1b5932b57f4dda8cc1262e00c66dc08f227f2e1bbbfe120c863b2066e8cae684/68747470733a2f2f7472617669732d63692e6f72672f6d6568722d69742f656c692d6d6964646c65776172652d636861696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mehr-it/eli-middleware-chain)

When defining a request processing chain, usually more than one middleware is involved into the processing chain. The `ChainHandler` allows to define the PSR-15 middleware processing stack as array or iterator:

```
$chain = new ChainHandler([
      new MiddlewareA(),
      new MiddlewareB(),
], $next);

```

This makes code much more readable and allows easy dynamic configuration of the middleware chain.

To create middleware instances on the fly - only when needed - resolver functions may be used:

```
$chain = new ChainHandler([
      function() { return new MiddlewareA(); },
      function() { return new MiddlewareB(); },
], $next);

```

Middleware instead of handler
-----------------------------

[](#middleware-instead-of-handler)

Sometimes a middleware chain is required as middleware itself. The `ChainMiddleware` can be used for such purposes. It's usage is straightforward as the `ChainHandler`:

```
$chain = new ChainMiddleware([
      new MiddlewareA(),
      new MiddlewareB(),
]);

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

2

Last Release

2315d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44973729?v=4)[mehr.IT GmbH](/maintainers/mehr-it)[@mehr-it](https://github.com/mehr-it)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mehr-it-eli-middleware-chain/health.svg)

```
[![Health](https://phpackages.com/badges/mehr-it-eli-middleware-chain/health.svg)](https://phpackages.com/packages/mehr-it-eli-middleware-chain)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

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

PHPackages © 2026

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