PHPackages                             minormous/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. minormous/dispatch

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

minormous/dispatch
==================

An HTTP Interop compatible middleware dispatcher

00PHP

Since Dec 13Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Minormous Dispatch
==================

[](#minormous-dispatch)

[![Latest Stable Version](https://camo.githubusercontent.com/a673da98ec76fbb0feea83043cf8196e9b63f6b9e4e688f7552535432d5a1e6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6f726d6f75732f64697370617463682e737667)](https://packagist.org/packages/minormous/dispatch)[![License](https://camo.githubusercontent.com/1f869c3825aa084d520ffe5e36de4a3a769b1fe5c48a6af8bac5b74106177dc2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696e6f726d6f75732f64697370617463682e737667)](https://github.com/minormous/dispatch/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/6fce91b846d6ffe658749896c7a4861db59c492853d3e0cf6762f861033aae6e/68747470733a2f2f7472617669732d63692e6f72672f6d696e6f726d6f75732f64697370617463682e737667)](https://travis-ci.org/minormous/dispatch)[![Code Coverage](https://camo.githubusercontent.com/6dc9e43d50d780ad715ac1c2750ae2c67abfae142716eca9fb24cbfbb819dfa2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e6f726d6f75732f64697370617463682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minormous/dispatch/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3ab7c66b4c8805ee506928991d9f928ab4c17d6d1ae7f182c39bb47c09b2d939/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e6f726d6f75732f64697370617463682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minormous/dispatch/?branch=master)

An HTTP Interop compatible middleware dispatcher in [Minormous](http://minormous.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://minormousframework.readthedocs.org/en/latest/dispatch).

Install
-------

[](#install)

```
composer require minormous/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 Minormous\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 Minormous\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

14

—

LowBetter than 2% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/0492d5da42191b4e3712895cf583d909b045c6acc2e8ae041a53a8b2038356a3?d=identicon)[baohx2000](/maintainers/baohx2000)

---

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)")[![gforsythe-godaddy](https://avatars.githubusercontent.com/u/95944072?v=4)](https://github.com/gforsythe-godaddy "gforsythe-godaddy (2 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (2 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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