Laminas Stratigility v1.3.0 Release Notes
Release Date: 2016-11-10 // almost 7 years ago-
โ Added
zendframework/zend-stratigility#66 adds a new class,
Laminas\Stratigility\Middleware\NotFoundHandler
. This class may be piped into an application at an innermost layer; when invoked, it will return a 404 plain text response.zendframework/zend-stratigility#66 adds a new class,
Laminas\Stratigility\Middleware\ErrorHandler
. This class may be piped into an application, typically at the outermost or one of the outermost layers. When invoked, it does the following:- Creates a PHP error handler that will re-throw PHP errors as
ErrorExceptions
. - Dispatches to the next layer.
- If the next layer does not return a response, it raises a new
MissingResponseException
. - Catches all exceptions from calling the next layer, and passes them to an error response generator to return an error response.
- Creates a PHP error handler that will re-throw PHP errors as
A default error response generator is provided, which will return a 5XX series response in plain text. You may provide a callable generator to the constructor in order to customize the response generated; please refer to the documentation for details.
zendframework/zend-stratigility#66 adds a new class,
Laminas\Stratigility\NoopFinalHandler
. This class may be provided as the$out
argument to aMiddlewarePipe
, or as the final handler toLaminas\Diactoros\Server::listen()
(in which case it will be passed to the middleware you invoke as the application). This handler returns the response provided to it verbatim.zendframework/zend-stratigility#70 adds a new class,
Laminas\Stratigility\Middleware\OriginalMessages
. Compose this middleware in an outermost layer, and it will inject the following attributes in the request passed to nested layers:originalRequest
, representing the request provided to it.originalResponse
, representing the response provided to it.originalUri
, representing URI instance composed in the request provided to it.
๐ zendframework/zend-stratigility#75 adds support for http-interop middleware 0.2.0. For full details, see the migration guide. As a summary of features:
- You may now pipe http-interop middleware to
MiddlewarePipe
instances. - You may now pipe callable middleware that defines the same signature as
http-interop middleware to
MiddlewarePipe
instances; these will be decorated in aLaminas\Stratigility\Middleware\CallableInteropMiddlewareWrapper
instance. MiddlewarePipe
now implements the http-interopServerMiddlewareInterface
, allowing it to be used in http-interop middleware dispatchers.
- You may now pipe http-interop middleware to
zendframework/zend-stratigility#75 adds the class
Laminas\Stratigility\Middleware\CallableMiddlewareWrapper
. It accepts callable double-pass middleware and a response prototype, and implements the http-interopServerMiddlewareInterface
, allowing you to adapt existing callable middleware to work with http-interop middleware dispatchers.zendframework/zend-stratigility#75 adds the class
Laminas\Stratigility\Middleware\CallableInteropMiddlewareWrapper
. It accepts callable middleware that follows the http-interopServerMiddlewareInterface
, and implements that interface itself, to allow composing such middleware in http-interop middleware dispatchers.zendframework/zend-stratigility#75 adds the class
Laminas\Stratigility\Delegate\CallableDelegateDecorator
, which can be used to add http-interop middleware support to your existing callable middleware.zendframework/zend-stratigility#75 adds a new method to
MiddlewarePipe
,setResponseProtoype()
. When this method is invoked with a PSR-7 response, the following occurs:- That response is injected in
Next
andDispatch
instances, to allow dispatching legacy callable middleware as if it were http-interop middleware. - Any callable middleware implementing the legacy signature will now be
decorated using the above
CallableMiddlewareWrapper
in order to adapt it as http-interop middleware.
- That response is injected in
zendframework/zend-stratigility#78 adds a new method to each of
Laminas\Stratigility\MiddlewarePipe
,Next
, andDispatch
:raiseThrowables()
. When called,Dispatch
will no longer wrap dispatch of middleware in a try/catch block, allowing throwables/exceptions to bubble out. This enables the ability to create error handling middleware as an outer layer or your application instead of relying on error middleware and/or the final handler. Typical usage will be to call the method on theMiddlewarePipe
before dispatching it.
๐ Changed
zendframework/zend-stratigility#70 makes the following changes to
Laminas\Stratigility\FinalHandler
:- It now pulls the original request using the
originalRequest
attribute, instead ofgetOriginalRequest()
; see the deprecation ofLaminas\Stratigility\Http\Request
, below, for why this works. - It no longer writes to the response using the
Laminas\Stratigility\Http\Response
-specificwrite()
method, but rather pulls the message body and writes to that.
- It now pulls the original request using the
โก๏ธ zendframework/zend-stratigility#75 updates
MiddlewarePipe
to inject the$response
argument to__invoke()
as the response prototype.โก๏ธ zendframework/zend-stratigility#75 updates
Laminas\Stratigility\Next
to implement the http-interop middlewareDelegateInterface
. It also updatesLaminas\Stratigility\Dispatch
to add a new method,process()
, following theDelegateInterface
signature, thus allowingNext
to properly process http-interop middleware. These methods will use the composed response prototype, if present, to invoke callable middleware using the legacy signature.โก๏ธ zendframework/zend-stratigility#75 updates
Next
to allow the$done
constructor argument to be an http-interopDelegateInterface
, and will invoke it as such if the queue is exhausted.โก๏ธ zendframework/zend-stratigility#75 updates
Route
(which is used internally byMiddlewarePipe
to allow either callable or http-interop middleware as route handlers.
๐ Deprecated
๐ zendframework/zend-stratigility#66 deprecates the
Laminas\Stratigility\FinalHandler
class. We now recommend using theNoopFinalHandler
, along with theErrorHandler
andNotFoundHandler
middleware (or equivalents) to provide a more fine-grained, flexible, error handling solution for your applications.๐ zendframework/zend-stratigility#66 deprecates the
Laminas\Stratigility\Dispatch
class. This class is used internally byNext
, and deprecation should not affect the majority of users.๐ zendframework/zend-stratigility#66 deprecates
Laminas\Stratigility\ErrorMiddlewareInterface
. We recommend instead using exceptions, along with theErrorHandler
, to provide error handling for your application.โก๏ธ zendframework/zend-stratigility#66 updates
Laminas\Stratigility\MiddlewarePipe::__invoke()
to emit a deprecation notice if no$out
argument is provided, as version 2 will require it.โก๏ธ zendframework/zend-stratigility#66 updates
Laminas\Stratigility\Next::__invoke()
to emit a deprecation notice if a non-null$err
argument is provided; middleware should raise an exception, instead of invoking middleware implementingErrorMiddlewareInterface
.๐ zendframework/zend-stratigility#70 deprecates
Laminas\Stratigility\Http\Request
. Additionally:- The composed "PSR Request" is now injected with an additional attribute,
originalRequest
, allowing retrieval using standard PSR-7 attribute access. - The methods
getCurrentRequest()
andgetOriginalRequest()
now emit deprecation notices when invoked, urging users to update their code.
- The composed "PSR Request" is now injected with an additional attribute,
๐ zendframework/zend-stratigility#70 deprecates
Laminas\Stratigility\Http\ResponseInterface
.๐ zendframework/zend-stratigility#70 deprecates
Laminas\Stratigility\Http\Response
. Additionally, the methodswrite()
,end()
,isComplete()
, andgetOriginalResponse()
now emit deprecation notices when invoked, urging users to update their code.๐ zendframework/zend-stratigility#75 deprecates the
$response
argument in existing callable middleware. Please only operate on the response returned by$next
/$delegate
, or create a response. See the documentation section on response arguments for more details.๐ zendframework/zend-stratigility#75 deprecates usage of error middleware, and thus deprecates the
$err
argument to$next
; explicitly invoking error middleware using that argument to$next
will now raise a deprecation notice.
โ Removed
- Nothing.
๐ Fixed
- Nothing.