zendframework / zend-stratigility

Middleware for PHP built on top of PSR-7 and PSR-15
BSD 3-Clause "New" or "Revised" License
235 stars 57 forks source link

Creates the `RequestHandlerMiddleware` class #150

Closed weierophinney closed 6 years ago

weierophinney commented 6 years ago

This class will decorate a RequestHandlerInterface instance such that it can act as either a request handler or middleware. When either handle() or process() are called, the class will instead proxy to the composed handler's handle() method, returning the result.

This can be useful for decorating request handlers to use within pipelines.

(Planned usage is within zend-expressive to allow decorating request handlers as middleware before piping to a pipeline or passing to a Route instance, and within zend-expressive-router, to decorate handlers as middleware within the constructor, so that getMiddleware() can return a single type.)