Laminas Stratigility v2.0.0 Release Notes

Release Date: 2017-01-24 // about 7 years ago
  • โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • zendframework/zend-stratigility#96 changes the minimum supported http-interop/http-middleware version to 0.4.1. This impacts several things:

      • Middleware that implemented the http-interop/http-middleware 0.2.0 interfaces will no longer work with Stratigility. In most cases, these can be updated by changing import statements. As an example:
      // http-middleware 0.2.0:
      use Interop\Http\Middleware\DelegateInterface;
      use Interop\Http\Middleware\ServerMiddlewareInterface;
      
      // Becomes the following under 0.4.1:
      use Interop\Http\ServerMiddleware\DelegateInterface;
      use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
      
      • The various classes under Laminas\Stratigility\Middleware now implement the new interfaces, which could affect extending classes.
      • Laminas\Stratigility\Next and Laminas\Stratigility\Delegate\CallableDelegateDecorator have signature changes due to changes in the DelegateInterface; again, these changes should only affect those extending the classes.
      • Interop\Http\Middleware\MiddlewareInterface (which was intended for implementation by client-side middleware) no longer exists, which means it is also no longer supported within Stratigility.
    • โšก๏ธ zendframework/zend-stratigility#67 updates each of Laminas\Stratigility\MiddlewarePipe, Laminas\Stratigility\Middleware\ErrorHandler, and Laminas\Stratigility\Middleware\NotFoundHandler to require all arguments (none are optional).

    • zendframework/zend-stratigility#67 modifies the internals of Laminas\Stratigility\MiddlewarePipe's __invoke() method.

      • When instantiating the Next instance, it now captures it in a variable named $layer.
      • If the result of Next is not a response instance, the response passed during invocation is promoted as the layer response.
      • The response is then passed to the $next argument provided at invocation, and the result of that returned without verification.

    In most cases, this should have no impact on your application.

    • zendframework/zend-stratigility#71 modifies Laminas\Stratigility\MiddlewarePipe such that it no longer decorates the request and response provided at invocation with the Laminas\Stratigility\Http\* variants, as these have been removed.

    • โšก๏ธ zendframework/zend-stratigility#76 updates MiddlewarePipe to implement only the http-interop/http-middleware server-side middleware interface, and not the Stratigility-specific MiddlewareInterface (which was removed).

    • โšก๏ธ zendframework/zend-stratigility#76 updates Laminas\Stratigility\Middleware\ErrorHandler to implement the http-interop/http-middleware server-side middleware interface instead of the Stratigility-specific MiddlewareInterface (which was removed).

    • โšก๏ธ zendframework/zend-stratigility#76 updates Laminas\Stratigility\Middleware\NotFoundHandler to implement the http-interop/http-middleware server-side middleware interface instead of the Stratigility-specific MiddlewareInterface (which was removed).

    • โšก๏ธ zendframework/zend-stratigility#76 updates MiddlewarePipe::__invoke() to require a third argument, now named $delegate, and no longer type-hinted. If a callable not implementing http-interop/http-middleware DelegateInterface is provided, it is wrapped in the CallableDelegateDecorator (introduced in 1.3.0). The method then calls its own process() method with the request and delegate. This method should typically only be used as an entry point for an application.

    • โšก๏ธ zendframework/zend-stratigility#76 updates MiddlewarePipe::pipe() to raise an exception if callable middleware using the legacy double-pass signature is provided, but no response prototype is composed in the MiddlewarePipe instance yet.

    • โšก๏ธ zendframework/zend-stratigility#76 updates the constructor of Next to rename the $done argument to $nextDelegate and typehint it against the http-interop/http-middleware DelegateInterface.

    • โšก๏ธ zendframework/zend-stratigility#76 updates Next::__invoke() to remove all arguments except the $request argument; the method now proxies to the instance process() method.

    • โšก๏ธ zendframework/zend-stratigility#76 updates Next to no longer compose a Dispatch instance; it is now capable of dispatching on its own.

    • โšก๏ธ zendframework/zend-stratigility#76 updates the Laminas\Stratigility\Route constructor to raise an exception if non-http-interop middleware is provided as the route handler.

    • โšก๏ธ zendframework/zend-stratigility#79 updates the raiseThrowables() method of each of MiddlewarePipe and Next to be no-ops.

    ๐Ÿ—„ Deprecated

    โœ‚ Removed

    • ๐Ÿšš Laminas\Stratigility\Exception\MiddlewareException was removed as it is no longer thrown.

    • ๐Ÿšš zendframework/zend-stratigility#67 removes Laminas\Stratigility\FinalHandler. Use Laminas\Stratigility\NoopFinalHandler instead, along with Laminas\Stratigility\Middleware\ErrorHandler and Laminas\Stratigility\Middleware\NotFoundHandler (or equivalents).

    • ๐Ÿšš zendframework/zend-stratigility#67 removes Laminas\Stratigility\ErrorMiddlewareInterface. Register middleware, such as Laminas\Stratigility\Middleware\ErrorHandler, in outer layers of your application to handle errors.

    • ๐Ÿšš zendframework/zend-stratigility#67 removes Laminas\Stratigility\Dispatch. This was an internal detail of the Next implementation, and should not affect most applications.

    • ๐Ÿšš zendframework/zend-stratigility#67 removes Laminas\Stratigility\Utils::getArity(). This was used only in Dispatch; since middleware signatures no longer vary, it is no longer necessary.

    • ๐Ÿšš zendframework/zend-stratigility#67 removes the final, optional $err argument to Laminas\Stratigility\Next(); raise exceptions instead, and provide error handling middleware such as Laminas\Stratigility\Middleware\ErrorHandler instead.

    • ๐Ÿšš zendframework/zend-stratigility#67 removes the $done argument to the Laminas\Stratigility\Next constructor.

    • ๐Ÿšš zendframework/zend-stratigility#71 removes the Laminas\Stratigility\Http\Request class.

    • ๐Ÿšš zendframework/zend-stratigility#71 removes the Laminas\Stratigility\Http\Response class.

    • ๐Ÿšš zendframework/zend-stratigility#71 removes Laminas\Stratigility\Http\ResponseInterface.

    • ๐Ÿšš zendframework/zend-stratigility#76 removes Laminas\Stratigility\MiddlewareInterface and Laminas\Stratigility\ErrorMiddlewareInterface. The latter is removed entirely, while the former is essentially replaced by http-interop's ServerMiddlewareInterface. You may still write callable middleware using the legacy double-pass signature, however.

    • ๐Ÿšš zendframework/zend-stratigility#76 removes the Laminas\Stratigility\Dispatch class. The class was an internal detail of Next, and no longer required.

    ๐Ÿ›  Fixed

    • Nothing.