PHPackages                             equip/dispatch - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. equip/dispatch

ActiveLibrary[HTTP &amp; Networking](/categories/http)

equip/dispatch
==============

An HTTP Interop compatible middleware dispatcher

2.0.0(8y ago)24339.9k↓18%3[1 PRs](https://github.com/equip/dispatch/pulls)17MITPHPPHP &gt;=7.0

Since Nov 14Pushed 5y ago10 watchersCompare

[ Source](https://github.com/equip/dispatch)[ Packagist](https://packagist.org/packages/equip/dispatch)[ RSS](/packages/equip-dispatch/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (11)Used By (17)

Equip Dispatch
==============

[](#equip-dispatch)

[![Latest Stable Version](https://camo.githubusercontent.com/4b7e7fc3598ab59f09816a857ef870d7f391ef2d527f9636b1772667d0bfcf21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65717569702f64697370617463682e737667)](https://packagist.org/packages/equip/dispatch)[![License](https://camo.githubusercontent.com/870c7a2131e6b4a1d17573d4a12ce3ff99e7102227e41b90052bed76b9584c02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f65717569702f64697370617463682e737667)](https://github.com/equip/dispatch/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/b261df07a5ff7c6070dce4338a315c77cd2608036f6cc7e8842c4cd90a0f26bd/68747470733a2f2f7472617669732d63692e6f72672f65717569702f64697370617463682e737667)](https://travis-ci.org/equip/dispatch)[![Code Coverage](https://camo.githubusercontent.com/a6ea1b9da785169df36908af345d28a91af0167da1b22b6623e7d655204d42b9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65717569702f64697370617463682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/equip/dispatch/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1bd3b6065e9664944208cdd673cce7110242e0306a741473331b5a97a36ace50/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65717569702f64697370617463682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/equip/dispatch/?branch=master)

An HTTP Interop compatible middleware dispatcher in [Equip](http://equip.github.io/). Attempts to be [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), [PSR-4](http://www.php-fig.org/psr/psr-4/), [PSR-7](http://www.php-fig.org/psr/psr-7/), and [PSR-15](http://www.php-fig.org/psr/psr-15/) compliant.

Heavily influenced by the design of [Tari by ircmaxwell](https://github.com/ircmaxell/Tari-PHP).

For more information, see [the documentation](http://equipframework.readthedocs.org/en/latest/dispatch).

Install
-------

[](#install)

```
composer require equip/dispatch

```

Usage
-----

[](#usage)

The `MiddlewareCollection` is a container for middleware that acts as the entry point. It takes two arguments:

- An array of `$middleware` which must be instances of server middleware.
- A callable `$default` that acts as the terminator for the collection and returns an empty response.

Once the collection is prepared it can dispatched with a server request and will return the response for output.

### Example

[](#example)

```
use Equip\Dispatch\MiddlewareCollection;

// Any implementation of PSR-15 MiddlewareInterface
$middleware = [
    new FooMiddleware(),
    // ...
];

// Default handler for end of collection
$default = function (ServerRequestInterface $request) {
    // Any implementation of PSR-7 ResponseInterface
    return new Response();
};

$collection = new MiddlewareCollection($middleware);

// Any implementation of PSR-7 ServerRequestInterface
$request = ServerRequest::fromGlobals();
$response = $collection->dispatch($request, $default);
```

### Nested Collections

[](#nested-collections)

The `MiddlewareCollection` also implements the `MiddlewareInterface` to allow collections to be nested:

```
use Equip\Dispatch\MiddlewareCollection;

// Any implementation of PSR-15 MiddlewareInterface
$middleware = [
    new FooMiddleware(),

    // A nested collection
    new MiddlewareCollection(...),

    // More middleware
    new BarMiddleware(),
    // ...
];

$collection = new MiddlewareCollection($middleware);

// HTTP factories can also be used
$default = [$responseFactory, 'createResponse'];
$request = $serverRequestFactory->createRequest($_SERVER);

$response = $collection->dispatch($request, $default);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 73.3% 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 ~48 days

Recently: every ~79 days

Total

10

Last Release

3034d ago

Major Versions

0.5.0 → 1.0.02017-11-29

1.0.0 → 2.0.02018-01-26

PHP version history (2 changes)0.1.0PHP &gt;=5.6

1.0.0PHP &gt;=7.0

### Community

Maintainers

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

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

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (33 commits)")[![tuupola](https://avatars.githubusercontent.com/u/21913?v=4)](https://github.com/tuupola "tuupola (6 commits)")[![schnittstabil](https://avatars.githubusercontent.com/u/6059032?v=4)](https://github.com/schnittstabil "schnittstabil (4 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/equip-dispatch/health.svg)

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

###  Alternatives

[league/openapi-psr7-validator

Validate PSR-7 messages against OpenAPI (3.0.2) specifications expressed in YAML or JSON

55715.9M69](/packages/league-openapi-psr7-validator)[league/route

Fast routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

6633.1M115](/packages/league-route)[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[relay/relay

A PSR-15 server request handler.

3302.1M86](/packages/relay-relay)[akrabat/ip-address-middleware

PSR-15 middleware that determines the client IP address and stores it as a ServerRequest attribute

1702.5M18](/packages/akrabat-ip-address-middleware)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

586.6M81](/packages/laminas-laminas-stratigility)

PHPackages © 2026

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