Laminas Stratigility v3.0.0 Release Notes

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

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

    • zendframework/zend-stratigility#150 adds a new class, Laminas\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.

    • zendframework/zend-stratigility#142 adds a new class, Laminas\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 '':
      $pipeline->pipe(new HostMiddlewareDecorator('', $middleware));

    Additionally, the patch provides a utility function, Laminas\Stratigility\host(), to simplify the above declaration:

      $pipeline->pipe(host('', $middleware));
    • zendframework/zend-stratigility#128 adds a marker interface, Laminas\Stratigility\Exception\ExceptionInterface; all package exceptions now implement this interface, allowing you to catch all package-related exceptions by typehinting against it.

    ๐Ÿ”„ Changed

    • โšก๏ธ zendframework/zend-stratigility#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).

    • zendframework/zend-stratigility#134 and zendframework/zend-stratigility#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.

    • zendframework/zend-stratigility#155 modifies each of the following classes to mark them final:

      • Laminas\Stratigility\Middleware\CallableMiddlewareDecorator
      • Laminas\Stratigility\Middleware\DoublePassMiddlewareDecorator
      • Laminas\Stratigility\Middleware\HostMiddlewareDecorator
      • Laminas\Stratigility\Middleware\NotFoundHandler
      • Laminas\Stratigility\Middleware\OriginalMessages
      • Laminas\Stratigility\Middleware\PathMiddlewareDecorator
      • Laminas\Stratigility\Middleware\RequestHandlerMiddleware
      • Laminas\Stratigility\Next
    • zendframework/zend-stratigility#134, zendframework/zend-stratigility#145, and zendframework/zend-stratigility#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.

    • ๐Ÿšš zendframework/zend-stratigility#134 removes the ability to specify a path when calling pipe(); use the PathMiddlewareDecorator or path() utility function to pipe middleware with path segregation.

    • zendframework/zend-stratigility#153 modifies the first argument of the Mezzio\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.

    • zendframework/zend-stratigility#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

    • ๐Ÿšš zendframework/zend-stratigility#163 removes Laminas\Stratigility\Middleware\PathRequestHandlerDecorator, as it was deprecated in 2.2, and no longer used with the 3.0 code base.

    • ๐Ÿšš zendframework/zend-stratigility#122 removes support for PHP versions 5.6, 7.0, as well as HHVM.

    • ๐Ÿšš zendframework/zend-stratigility#122 removes the following classes:

      • Laminas\Stratigility\Delegate\CallableDelegateDecorator
      • Laminas\Stratigility\Exception\InvalidRequestTypeException
      • Laminas\Stratigility\Exception\MissingResponsePrototypeException
      • Laminas\Stratigility\MiddlewareInterface
      • Laminas\Stratigility\Middleware\CallableInteropMiddlewareWrapper
      • Laminas\Stratigility\Middleware\CallableMiddlewareWrapper
      • Laminas\Stratigility\Middleware\CallableMiddlewareWrapperFactory
      • Laminas\Stratigility\NoopFinalHandler
    • ๐Ÿšš zendframework/zend-stratigility#134 removes the class Laminas\Stratigility\Route. This was an internal message passed between a MiddlewarePipe and Next instance, and its removal should not affect end users.

    • ๐Ÿšš zendframework/zend-stratigility#134 removes Laminas\Stratigility\Exception\InvalidMiddlewareException, as the exception is no longer raised by MiddlewarePipe.

    ๐Ÿ›  Fixed

    • Nothing.