zend-stratigility 3.0.0
Added
-
#146 adds a new interface,
Zend\Stratigility\MiddlewarePipeInterface
. It extends the PSR-15MiddlewareInterface
andRequestHandlerInterface
, and defines one additional method,pipe(MiddlewareInterface $middleware) : void
. -
#150 adds a new class,
Zend\Stratigility\Middleware\RequestHandlerMiddleware
. The class implements the PSR-15RequestHandlerInterface
andMiddlewareInterface
, and accepts a single constructor argument, aRequestHandlerInterface
instance. Each of itshandle()
andprocess()
methods proxy to the composed request handler'shandle()
method, returning its result.This class can be useful for adapting request handlers to use within pipelines.
-
#142 adds a new class,
Zend\Stratigility\Middleware\HostMiddlewareDecorator
, which provides host segregation functionality for middleware, allowing conditional execution of middleware only if the requested host matches a configured host.// Only process $middleware if the request host matches 'example.com': $pipeline->pipe(new HostMiddlewareDecorator('example.com', $middleware));
Additionally, the patch provides a utility function,
Zend\Stratigility\host()
, to simplify the above declaration:$pipeline->pipe(host('example.com', $middleware));
-
#128 adds a marker interface,
Zend\Stratigility\Exception\ExceptionInterface
; all package exceptions now implement this interface, allowing you to catch all package-related exceptions by typehinting against it.
Changed
-
#145 updates the component to implement and consume ONLY PSR-15 interfaces; http-interop interfaces and callable middleware are no longer directly supported (though Stratigility provides decorators for the latter in order to cast them to PSR-15 implementations).
-
#134 and #146 modify
MiddlewarePipe
in two ways: it now implements the newMiddlewarePipeInterface
, and is marked asfinal
, disallowing direct extension. Either decorate an instance in a customMiddlewarePipeInterface
implementation, or create a custom PSR-15MiddlewareInterface
implementation if piping is not necessary or will allow additional types. -
#155 modifies each of the following classes to mark them
final
:Zend\Stratigility\Middleware\CallableMiddlewareDecorator
Zend\Stratigility\Middleware\DoublePassMiddlewareDecorator
Zend\Stratigility\Middleware\HostMiddlewareDecorator
Zend\Stratigility\Middleware\NotFoundHandler
Zend\Stratigility\Middleware\OriginalMessages
Zend\Stratigility\Middleware\PathMiddlewareDecorator
Zend\Stratigility\Middleware\RequestHandlerMiddleware
Zend\Stratigility\Next
-
#134, #145, and #146 update
MiddlewarePipe
to implementPsr\Http\Server\RequestHandlerInterface
. Calling it will cause it to pull the first middleware off the queue and create aNext
implementation that uses the remaining queue as the request handler; it then processes the middleware. -
#134 removes the ability to specify a path when calling
pipe()
; use thePathMiddlewareDecorator
orpath()
utility function to pipe middleware with path segregation. -
#153 modifies the first argument of the
Zend\Expressive\Middleware\ErrorHandler
andNotFoundHandler
classes. Previously, they each expected aPsr\Http\Message\ResponseInterface
instance; they now both expect a PHP callable capable of producing such an instance. This change was done to simplify re-use of a service for producing unique response instances within dependency injection containers. -
#157 marks the package as conflicting with zendframework/zend-diactoros versions less than 1.7.1. This is due to the fact that that version provides a bugfix for its
Uri::getHost()
implementation that ensures it follows the PSR-7 and IETF RFC 3986 specifications.
Deprecated
- Nothing.
Removed
-
#163 removes
Zend\Stratigility\Middleware\PathRequestHandlerDecorator
, as it was deprecated in 2.2, and no longer used with the 3.0 code base. -
#122 removes support for PHP versions 5.6, 7.0, as well as HHVM.
-
#122 removes the following classes:
Zend\Stratigility\Delegate\CallableDelegateDecorator
Zend\Stratigility\Exception\InvalidRequestTypeException
Zend\Stratigility\Exception\MissingResponsePrototypeException
Zend\Stratigility\MiddlewareInterface
Zend\Stratigility\Middleware\CallableInteropMiddlewareWrapper
Zend\Stratigility\Middleware\CallableMiddlewareWrapper
Zend\Stratigility\Middleware\CallableMiddlewareWrapperFactory
Zend\Stratigility\NoopFinalHandler
-
#134 removes the class
Zend\Stratigility\Route
. This was an internal message passed between aMiddlewarePipe
andNext
instance, and its removal should not affect end users. -
#134 removes
Zend\Stratigility\Exception\InvalidMiddlewareException
, as the exception is no longer raised byMiddlewarePipe
.
Fixed
- Nothing.