Expressive v2.0.0 Release Notes
Release Date: 2017-03-07 // about 7 years ago-
โ Added
๐ #450 adds support for PSR-11; Expressive is now a PSR-11 consumer.
โก๏ธ #428 updates the zend-stratigility dependency to require
^2.0
; this allows usage of both the new middleare-based error handling system introduced in zend-stratigility 1.3, as well as usage of http-interop/http-middleware implementations with Expressive. The following middleware is now supported:- Implementations of
Interop\Http\ServerMiddleware\MiddlewareInterface
. - Callable middleware that implements the same signature as
Interop\Http\ServerMiddleware\MiddlewareInterface
. - Callable middleware using the legacy double-pass signature
(
function ($request, $response, callable $next)
); these are now decorated inZend\Stratigility\Middleware\CallableMiddlewareWrapper
instances. - Service names resolving to any of the above.
- Arrays of any of the above; these will be cast to
Zend\Stratigility\MiddlewarePipe
instances, piping each middleware.
- Implementations of
#396 adds
Zend\Expressive\Middleware\NotFoundHandler
, which provides a way to return a templated 404 response to users. This middleware should be used as innermost middleware. You may use the newZend\Expressive\Container\NotFoundHandlerFactory
to generate the instance via your DI container.#396 adds
Zend\Expressive\Container\ErrorHandlerFactory
, for generating aZend\Stratigility\Middleware\ErrorHandler
to use with your application. If aZend\Expressive\Middleware\ErrorResponseGenerator
service is present in the container, it will be used to seed theErrorHandler
with a response generator. If you use this facility, you should enable thezend-expressive.raise_throwables
configuration flag.#396 adds
Zend\Expressive\Middleware\ErrorResponseGenerator
andZend\Expressive\Middleware\WhoopsErrorResponseGenerator
, which may be used withZend\Stratigility\Middleware\ErrorHandler
to generate error responses. The first will generate templated error responses if a template renderer is composed, and the latter will generate Whoops output. You may use the newZend\Expressive\Container\ErrorResponseGeneratorFactory
andZend\Expressive\Container\WhoopsErrorResponseGeneratorFactory
, respectively, to create these instances; if you do, assign these to the service nameZend\Expressive\Middleware\ErrorResponseGenerator
to have them automatically registered with theErrorHandler
.#396 adds
Zend\Expressive\ApplicationConfigInjectionTrait
, which exposes two methods,injectRoutesFromConfig()
andinjectPipelineFromConfig()
; this trait is now composed into theApplication
class. These methods allow you to configure anApplication
instance from configuration if desired, and are now used by theApplicationFactory
to configure theApplication
instance.#396 adds a vendor binary,
vendor/bin/expressive-tooling
, which will install (or uninstall) the zend-expressive-tooling; this package provides migration tools for updating your application to use programmatic pipelines and the new error handling strategy, as well as tools for identifying usage of the legacy Stratigility request and response decorators and error middleware.#413 adds the middleware
Zend\Expressive\Middleware\ImplicitHeadMiddleware
; this middleware can be used to provide implicit support forHEAD
requests when the matched route does not explicitly support the method.#413 adds the middleware
Zend\Expressive\Middleware\ImplicitOptionsMiddleware
; this middleware can be used to provide implicit support forOPTIONS
requests when the matched route does not explicitly support the method; the returned 200 response will also include anAllow
header listing allowed HTTP methods for the URI.#426 adds the method
Application::getRoutes()
, which will return the list ofZend\Expressive\Router\Route
instances currently registered with the application.#428 adds the class
Zend\Expressive\Delegate\NotFoundDelegate
, anInterop\Http\ServerMiddleware\DelegateInterface
implementation. The class will return a 404 response; if aTemplateRendererInterface
is available and injected into the delegate, it will provide templated contents for the 404 response as well. We also provideZend\Expressive\Container\NotFoundDelegateFactory
for providing an instance.#428 adds the method
Zend\Expressive\Application::getDefaultDelegate()
. This method will return the defaultInterop\Http\ServerMiddleware\DelegateInterface
injected during instantiation, or, if none was injected, lazy load an instance ofZend\Expressive\Delegate\NotFoundDelegate
.#428 adds the constants
DISPATCH_MIDDLEWARE
andROUTING_MIDDLEWARE
toZend\Expressive\Application
; they have identical values to the constants previously defined inZend\Expressive\Container\ApplicationFactory
.#428 adds
Zend\Expressive\Middleware\LazyLoadingMiddleware
; this essentially extracts the logic previously used withinZend\Expressive\Application
to provide container-based middleware to allow lazy-loading only when dispatched.
๐ Changes
#440 changes the
Zend\Expressive\Application::__call($method, array $args)
signature; in previous versions,$args
did not have a typehint. If you are extending the class and overriding this method, you will need to update your signature accordingly.โก๏ธ #428 updates
Zend\Expressive\Container\ApplicationFactory
to ignore thezend-expressive.raise_throwables
configuration setting; Stratigility 2.X no longer catches exceptions in its middleware dispatcher, making the setting irrelevant.โก๏ธ #422 updates the zend-expressive-router minimum supported version to 2.0.0.
#428 modifies the
Zend\Expressive\Container\ApplicationFactory
constantsDISPATCH_MIDDLEWARE
andROUTING_MIDDLEWARE
to define themselves based on the constants of the same name now defined inZend\Expressive\Application
.#428 modifies the constructor of
Zend\Expressive\Application
; the third argument was previously a nullable callable$finalHandler
; it is now a nullableInterop\Http\ServerMiddleware\DelegateInterface
with the name$defaultDelegate
.#450 modifies the signatures in several classes to typehint against PSR-11 instead of container-interop; these include:
Zend\Expressive\AppFactory::create()
Zend\Expressive\Application::__construct()
Zend\Expressive\Container\ApplicationFactory::__invoke()
Zend\Expressive\Container\ErrorHandlerFactory::__invoke()
Zend\Expressive\Container\ErrorResponseGeneratorFactory::__invoke()
Zend\Expressive\Container\NotFoundDelegateFactory::__invoke()
Zend\Expressive\Container\NotFoundHandlerFactory::__invoke()
Zend\Expressive\Container\WhoopsErrorResponseGeneratorFactory::__invoke()
Zend\Expressive\Container\WhoopsFactory::__invoke()
Zend\Expressive\Container\WhoopsPageHandlerFactory::__invoke()
#450 changes the interface inheritance of
Zend\Expressive\Container\Exception\InvalidServiceException
to extendPsr\Container\ContainerExceptionInterface
instead ofInterop\Container\Exception\ContainerException
.
๐ Deprecated
- Nothing.
โ Removed
๐ #428 removes the following routing/dispatch methods from
Zend\Expressive\Application
:routeMiddleware()
; this is now encapsulated inZend\Expressive\Middleware\RouteMiddleware
.dispatchMiddleware()
; this is now encapsulated inZend\Expressive\Middleware\DispatchMiddleware
.
๐ #428 removes the various "final handler" implementations and related factories. Users should now use the "default delegates" as detailed in sections previous. Classes and methods removed include:
Zend\Expressive\Application::getFinalHandler()
Zend\Expressive\TemplatedErrorHandler
Zend\Expressive\WhoopsErrorHandler
Zend\Expressive\Container\TemplatedErrorHandlerFactory
Zend\Expressive\Container\WhoopsErrorHandlerFactory
๐ #428 removes the
Zend\Expressive\ErrorMiddlewarePipe
class, as zend-stratigility 2.X no longer definesZend\Stratigility\ErrorMiddlewareInterface
or has a concept of variant-signature error middleware. Use standard middleware to provide error handling now.๐ #428 removes the exception types
Zend\Expressive\Container\Exception\InvalidArgumentException
(useZend\Expressive\Exception\InvalidArgumentException
instead) andZend\Expressive\Container\Exception\NotFoundException
(which was never used internally).
๐ Fixed
- Nothing.