Releases: zendframework/zend-expressive
Expressive 2.0.0
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.
Expressive 1.1.1
Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #447 fixes an error in the
ApplicationFactory
that occurs when theconfig
service is anArrayObject
. Prior to the fix,ArrayObject
configurations would cause a fatal error when injecting the pipeline and/or routes.
Expressive 1.1.0
This release is primarily intended to introduce deprecations and forwards compatibility features in preparation for a forthcoming 2.0.0 release. Please read the migration document for details.
This release is fully backwards compatible with previous Expressive versions, and will be installed when creating an Expressive project from the existing 1.X series of the Expressive Skeleton.
Added
-
#309 adds the ability to provide options with which to instantiate the
FinalHandler
instance, via the configuration:[ 'final_handler' => [ 'options' => [ /* array of options */ ], ],
-
#373 adds interception of exceptions from the
ServerRequestFactory
for invalid request information in order to return400
responses. -
#432 adds two new configuration flags for use with
Zend\Expressive\Container\ApplicationFactory
:zend-expressive.programmatic_pipelines
: when enabled, the factory will ignore themiddleware_pipeline
androutes
configuration, allowing you to wire these programmatically instead. We recommend creating these in the filesconfig/pipeline.php
andconfig/routes.php
, respectively, and modifying yourpublic/index.php
torequire
these files in statements immediately preceding the call to$app->run()
.zend-expressive.raise_throwables
: when enabled, this will be used to notify zend-stratigility's internal dispatcher to no longer catch exceptions/throwables, and instead allow them to bubble out. This allows you to write custom middleware for handling errors.
-
#429 adds
Zend\Expressive\Application::getDefaultDelegate()
as a forwards-compatibility measure for the upcoming version 2.0.0. Currently, it proxies togetFinalHandler()
. -
#435 adds support for the 2.X versions of zend-expressive-router and the various router implementations. This change also allows usage of zend-expressive-helpers 3.X.
Changed
- #429 updates the minimum supported zend-stratigility version to 1.3.3.
- #396 updates the
Zend\Expressive\Container\ApplicationFactory
to vary creation of theApplication
instance based on two new configuration variables:zend-expressive.programmatic_pipeline
will cause the factory to skip injection of the middleware pipeline and routes from configuration. It is then up to the developer to do so, or use theApplication
API to pipe middleware and/or add routed middleware.zend-expressive.raise_throwables
will cause the factory to call the newraiseThrowables()
method exposed byApplication
(and inherited fromZend\Stratigility\MiddlewarePipe
). Doing so will cause the application to raise anyThrowable
orException
instances caught, instead of catching them and dispatching them to (legacy) Stratigility error middleware.
Deprecated
- #429 deprecates the following methods and classes:
Zend\Expressive\Application::pipeErrorHandler()
; use theraise_throwables
flag and standard middleware to handle errors instead.Zend\Expressive\Application::routeMiddleware()
; this is extracted to a dedicated middleware class for 2.0.Zend\Expressive\Application::dispatchMiddleware()
; this is extracted to a dedicated middleware class for 2.0.Zend\Expressive\Application::getFinalHandler()
(this patch providesgetDefaultDelegate()
as a forwards-compatibility measure) -Zend\Expressive\Container\Exception\InvalidArgumentException
; this will be removed in 2.0.0, and places where it was used will instead throwZend\Expressive\Exception\InvalidArgumentException
.Zend\Expressive\Container\Exception\NotFoundException
; this exception is never thrown at this point.Zend\Expressive\Container\TemplatedErrorHandlerFactory
Zend\Expressive\Container\WhoopsErrorHandlerFactory
Zend\Expressive\ErrorMiddlewarePipe
; Stratigility 1.3 deprecates itsZend\Stratigility\ErrorMiddlewareInterface
, and removes it in version 2.0. use theraise_throwables
flag and standard middleware to handle errors instead.Zend\Expressive\TemplatedErrorHandler
; the "final handler" concept is retired in Expressive 2.0, and replaced with default delegates (classes implementingInterop\Http\ServerMiddleware\DelegateInterface
that will be executed when the internal pipeline is exhausted, in order to guarantee a response). If you are using custom final handlers, you will need to rewrite them when adopting Expressive 2.0.Zend\Expressive\WhoopsErrorHandler
Removed
- #406 removes the
RouteResultSubjectInterface
implementation fromZend\Expressive\Application
, per the deprecation prior to the 1.0 stable release.
Fixed
- #442 fixes how the
WhoopsFactory
disables JSON output for whoops; previously, providing booleanfalse
values for either of the configuration flagsjson_exceptions.show_trace
orjson_exceptions.ajax_only
would result in enabling the settings; these flags are now correctly evaluated by theWhoopsFactory
.
Expressive 1.0.6
Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #420 fixes the
routeMiddleware()
's handling of 405 errors such that it now no longer emits deprecation notices when running under the Stratigility 1.3 series.
Expressive 1.0.5
Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #403 updates the
AppFactory::create()
logic to raise exceptions in either of the following scenarios:- no container is specified, and the class
Zend\ServiceManager\ServiceManager
is not available. - no router is specified, and the class
Zend\Expressive\Router\FastRouteRouter
is not available.
- no container is specified, and the class
- #405 fixes how the
TemplatedErrorHandler
injects templated content into the response. Previously, it wouldwrite()
directly to the existing response body, which could lead to issues if previous middleware had written to the response (as the templated contents would append the previous contents). With this release, it now creates a newZend\Diactoros\Stream
, writes to that, and returns a new response with that new stream, guaranteeing it only contains the new contents. - #404 fixes the
swallowDeprecationNotices()
handler such that it will not swallow a global handler once application execution completes.
Expressive 1.0.4
Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #402 fixes how
Application::__invoke()
registers the error handler designed to swallow deprecation notices, as introduced in 1.0.3. It now checks to see if another error handler was previously registered, and, if so, creates a composite handler that will delegate to the previous for all other errors.
Expressive 1.0.3
Added
- Nothing.
Changes
- #395 updates
Application::__invoke()
to add an error handler to swallow deprecation notices due to triggering error middleware when using Stratigility 1.3+. Since error middleware is triggered whenever theraiseThrowables
flag is not enabled and an error or empty queue situation is encountered, handling it this way prevents any such errors from bubbling out of the application.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Expressive 1.0.2
Added
- Nothing.
Changes
- #393 updates
Application::run()
to inject the request with anoriginalResponse
attribute using the provided response as the value.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #393 fixes how each of the
TemplatedErrorHandler
andWhoopsErrorHandler
access the "original" request, URI, and/or response. Previously, these used Stratigility-specific methods; they now use request attributes, eliminating deprecation notices emitted in Stratigility 1.3+ versions.
Expressive 1.0.1
Added
- #306 adds a cookbook recipe covering flash messages.
- #384 adds support for Whoops version 2 releases, providing PHP 7 support for Whoops.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #391 fixes the
Application::run()
implementation to prevent emission of deprecation notices when used with Stratigility 1.3.
Expressive 1.0.0
Initial stable release.
Added
- #279 updates the documentation to provide automation for pushing to GitHub pages. As part of that work, documentation was re-organized, and a landing page provided. Documentation can now be found at: https://zendframework.github.io/zend-expressive/
- #299 adds component-specific CSS to the documentation.
- #295 adds support for handling PHP 7 engine exceptions in the templated and whoops final handlers.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #280 fixes references to the
PlatesRenderer
in the error handling documentation. - #284 fixes the reference to maximebf/php-debugbar in the debug bar documentation.
- #285 updates the section on mtymek/blast-base-url in the "Using a Base Path" cookbook recipe to conform to its latest release.
- #286 fixes the documentation of the Composer "serve" command to correct a typo.
- #291 fixes the documentation links to the RC5 -> v1 migration guide in both the CHANGELOG as well as the error messages emitted, ensuring users can locate the correct documentation in order to upgrade.
- #287 updates the "standalone" quick start to reference calling
$app->pipeRoutingMiddleware()
and$app->pipeDispatchMiddleware()
per the changes in RC6. - #293 adds a
require 'vendor/autoload.php';
line to the bootstrap script referenced in the zend-servicemanager examples. - #294 updates the namespace referenced in the modulear-layout documentation to provide a better separation between the module/package/whatever, and the application consuming it.
- #298 fixes a typo in a URI generation example.