mindplay/middleman
PSR-15 middleware dispatcher for PHP that composes middleware into a single request handler. Supports lazy middleware resolution from a PSR-11 container, class-name based middleware, and PSR-7/PSR-15 stacks, making it easy to build clean, layered HTTP applications.
Closure-based pipeline. That affects hiring, code review criteria, and how third-party middleware can be reused. It also constrains us: we would not get Laravel's handle/terminate lifecycle, route middleware aliases, or $next($request) ergonomics for free.Adopt it when all of the following hold:
Look elsewhere when:
Illuminate\Pipeline and HTTP kernel are Closure-based, not PSR-15. Bridging means adding symfony/psr-http-message-bridge plus a PSR-7 implementation, converting requests and responses at the boundary, and losing terminate(), route middleware parameters, and middleware groups. That is real complexity for a dispatcher we already have.RequestHandler bootstrapping, no error middleware, no response emitting — relay/relay, middlewares/runner, laminas/laminas-stratigility, or a micro-framework gives a fuller story.To executives: This is a tiny, standards-based piece of plumbing — not a platform commitment. It lets us order and run HTTP middleware against the industry-standard PSR-15 interface instead of a framework-specific one, which means our HTTP layer can move between frameworks and can be handed to partners without asking them to adopt Laravel. It is roughly 300 lines of dependency-free code, so the downside is bounded: worst case we fork it, which is cheaper than the meetings required to evaluate a larger framework. Recommendation: not a strategic dependency — treat it as commodity code we are willing to own. Low stars, zero dependents, and a 2021 release date mean we should not assume the community maintains it for us.
To engineering: Use it if we are already PSR-7/PSR-15 and want a dispatcher that does exactly one thing: resolve middleware from the PSR-11 container on demand and run the chain. It gives us lazy instantiation and constructor injection for middleware with no framework attached. Do not reach for it inside a stock Laravel service — the PSR bridge cost exceeds the benefit, and Laravel's pipeline already covers us. If we adopt, pin the version, vendor the source, and add a short internal note on the fork path and PHP 8 compatibility. Budget half a day to read the whole library; it is small enough that "we understand all of it" is a realistic claim, which is the main reason to prefer it over a heavier alternative.
How can I help you explore Laravel packages today?