zend-stratigility v3.0.0 Release Notes

Release Date: 2018-03-15 // about 6 years ago
  • โž• Added

    • #146 adds a new interface, Zend\Stratigility\MiddlewarePipeInterface. It extends the PSR-15 MiddlewareInterface and RequestHandlerInterface, and defines one additional method, pipe(MiddlewareInterface $middleware) : void.

    • #150 adds a new class, Zend\Stratigility\Middleware\RequestHandlerMiddleware. The class implements the PSR-15 RequestHandlerInterface and MiddlewareInterface, and accepts a single constructor argument, a RequestHandlerInterface instance. Each of its handle() and process() methods proxy to the composed request handler's handle() 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 new MiddlewarePipeInterface, and is marked as final, disallowing direct extension. Either decorate an instance in a custom MiddlewarePipeInterface implementation, or create a custom PSR-15 MiddlewareInterface 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 implement Psr\Http\Server\RequestHandlerInterface. Calling it will cause it to pull the first middleware off the queue and create a Next 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 the PathMiddlewareDecorator or path() utility function to pipe middleware with path segregation.

    • #153 modifies the first argument of the Zend\Expressive\Middleware\ErrorHandler and NotFoundHandler classes. Previously, they each expected a Psr\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 a MiddlewarePipe and Next instance, and its removal should not affect end users.

    • ๐Ÿšš #134 removes Zend\Stratigility\Exception\InvalidMiddlewareException, as the exception is no longer raised by MiddlewarePipe.

    ๐Ÿ›  Fixed

    • Nothing.