For over a year, since 2.7, we have had the ability to use a single middleware in a Zend\Mvc-based application (if
you're not familiar, that's basically "Zend Framework" as opposed to "Zend Expressive"). A nice advantage here is you
can make a forward-port path to migrating across to Zend Expressive. Your config might look something like

This change was great, and I did some work for a client who had started using the MiddlewareListener to attach a
middleware to a route like this, and saw it in action. Over time I discovered a couple of flaws. Firstly, the matched
route information was unavailable, so if you had a route matcher like /foo/:slug, there was no nice way to discover
the value of slug from the matched route. So, dutifully I created patch
#210 to resolve this issue, which was accepted and released in
Zend\Mvc 3.0.4 and up.

Before long, I discovered another glaringly obvious problem: you could only ever have a single middleware added here.
If you're familiar with middleware-style applications, this completely defeats the point: you can pipe your middleware
to inject behaviour (such as authentication, error handling etc.) but this was not possible.

So, leveraging the existing functionality of Zend\Stratigility pipes, I heavily refactored the MiddlewareListener to
instead create a pipe from the middleware definition from config. I made it backwards compatible in the sense that the
configuration above would still work, but now you can attach multiple middlewares to a route, like so:

This patch recently got merged in Zend\Mvc 3.1.0
so you can now take advantage of this handy new feature. I also added support for middlewares that implement
Interop\Http\ServerMiddleware\MiddlewareInterface too, so you can now write something like: