PHPackages                             northwoods/broker - 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. northwoods/broker

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

northwoods/broker
=================

Dead simple PSR-15 middleware dispatcher

3.0.0(7y ago)27105.5k↑27.8%3MITPHPPHP &gt;=7.1

Since Jul 21Pushed 7y ago2 watchersCompare

[ Source](https://github.com/northwoods/broker)[ Packagist](https://packagist.org/packages/northwoods/broker)[ RSS](/packages/northwoods-broker/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (7)Versions (8)Used By (3)

Northwoods Broker
=================

[](#northwoods-broker)

[![Become a Supporter](https://camo.githubusercontent.com/28a4011c597c1f2866c7419fcefd80ec11a8591e34f94612242c09e86e8a30dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d73706f6e736f722532306d652d6536343631612e737667)](https://www.patreon.com/shadowhand)[![Latest Stable Version](https://camo.githubusercontent.com/15db86591d3592441b9a7228dcaee918163e016c4e2548f36df898132dd183ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f727468776f6f64732f62726f6b65722e737667)](https://packagist.org/packages/northwoods/broker)[![License](https://camo.githubusercontent.com/6ec5e2bcee7c3a33e9d4b5eafc0a60f9c60c9cefa89aae2db26600acde9d5074/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f727468776f6f64732f62726f6b65722e737667)](https://github.com/northwoods/broker/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/fc40504167318001cdebbbd1b2f7ecec211fb0eb274bd4833045c4bcce06d06c/68747470733a2f2f7472617669732d63692e636f6d2f6e6f727468776f6f64732f62726f6b65722e737667)](https://travis-ci.com/northwoods/broker)[![Code Coverage](https://camo.githubusercontent.com/730532ec8f660d37dc00dcdc2e90fc518f736860ea8e5c5ede394800db33155f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f62726f6b65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/broker/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6fed45b0e2aec80541b4f04ecda359e54367fafcc8145db6eb7e9074230370f7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f62726f6b65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/broker/?branch=master)

Broker is a dead simple [PSR-15](http://www.php-fig.org/psr/psr-15/) middleware dispatcher. Broker implements both `RequestHandlerInterface` and `MiddlewareInterface` for maximum flexibility.

Install
-------

[](#install)

```
composer require northwoods/broker

```

Usage
-----

[](#usage)

```
use Acme\Middleware;
use Northwoods\Broker\Broker;

/** @var \Psr\Http\Message\ServerRequestInterface */
$request = /* any server request */;

// Use append() or prepend() to add middleware
$broker = new Broker();
$broker->append(new Middleware\ParseRequest());
$broker->prepend(new Middleware\CheckIp());

/** @var \Psr\Http\Message\ResponseInterface */
$response = $broker->handle($request);
```

### `append(...$middleware)`

[](#appendmiddleware)

Add one or more middleware to the end of the stack.

### `prepend(...$middleware)`

[](#prependmiddleware)

Add one or more middleware to be beginning of the stack.

### `handle($request)`

[](#handlerequest)

Dispatch the middleware stack as a request handler. If the end of the stack is reached and no response has been generated, an `OutOfBoundsException` will be thrown.

### `process($request, $handler)`

[](#processrequest-handler)

Dispatch the middleware stack as a middleware. If the end of the stack is reached and no response has been generated, the `$handler` will be called.

Suggested Packages
------------------

[](#suggested-packages)

- Conditional middleware execution can be provided by [northwoods/conditional-middleware](https://github.com/northwoods/conditional-middleware)
- Lazy middleware instantiation can be provided by [northwoods/lazy-middleware](https://github.com/northwoods/lazy-middleware)
- Response sending can be provided by [http-interop/response-sender](https://github.com/http-interop/response-sender)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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 ~75 days

Recently: every ~98 days

Total

7

Last Release

2816d ago

Major Versions

0.3.0 → 1.0.02017-12-02

1.1.0 → 2.0.02018-01-26

2.0.0 → 3.0.02018-10-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38203?v=4)[Woody Gilk](/maintainers/shadowhand)[@shadowhand](https://github.com/shadowhand)

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (22 commits)")[![XedinUnknown](https://avatars.githubusercontent.com/u/1428973?v=4)](https://github.com/XedinUnknown "XedinUnknown (1 commits)")

---

Tags

dispatcherhttpmiddlewarepsr-15serverhttpmiddlewareserverpsr-15dispatcherpsr15dispatch

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/northwoods-broker/health.svg)

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

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M125](/packages/mezzio-mezzio)[middlewares/request-handler

Middleware to execute request handlers

451.8M30](/packages/middlewares-request-handler)[middlewares/fast-route

Middleware to use FastRoute

98205.1k15](/packages/middlewares-fast-route)[middlewares/negotiation

Middleware to implement content negotiation

46458.6k11](/packages/middlewares-negotiation)[middlewares/payload

Middleware to parse the body of the request with support for json, csv and url-encode

33472.0k18](/packages/middlewares-payload)[middlewares/http-authentication

Middleware to implement Basic and Digest Http authentication

34306.4k2](/packages/middlewares-http-authentication)

PHPackages © 2026

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