All notable changes to this project will be documented in this file, in reverse chronological order by release.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #34 changes suggested version of laminas-auradi-config to 2.0.
- Nothing.
- Nothing.
-
#39 fixes the factories for the
NotFoundHandlerandErrorResponseGeneratorto castnulllayout values from configuration to empty strings. -
zendframework/zend-expressive#663 fixes parameter types in docblock for
Mezzio\MiddlewareFactory::pipeline()
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#646 fixes behavior in the
MiddlewareContainerwhen retrieving services that implement bothRequestHandlerInterfaceandMiddlewareInterface. Previously, it incorrectly cast these values toRequestHandlerMiddleware, which could cause middleware pipelines to fail if they attempted to delegate back to the application middleware pipeline. These values are now correctly returned verbatim.
- zendframework/zend-expressive#637 adds support for zendframework/zend-diactoros 2.0.0. You may use either a 1.Y or 2.Y version of that library with Expressive applications.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#634 provides several minor performance and maintenance improvements.
- Nothing.
- zendframework/zend-expressive#629 changes the constructor of
Mezzio\Middleware\ErrorResponseGeneratorto accept an additional, optional argument,$layout, which defaults to a new constant value,ErrorResponseGenerator::LAYOUT_DEFAULT, orlayout::default.Mezzio\Container\ErrorResponseGeneratorFactorynow also looks for the configuration valuemezzio.error_handler.layout, and will use that value to seed the constructor argument. This change makes theErrorResponseGeneratormirror theNotFoundHandler, allowing for a consistent layout between the two error pages.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#615 adds a cookbook entry for accessing common data in templates.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#627 fixes an issue in the Whoops response generator; previously, if an error or
exception occurred in an
ErrorHandlerlistener or prior to handling the pipeline, Whoops would fail to intercept, resulting in an empty response with status 200. With the patch, it properly intercepts and displays the errors.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#612 updates the
ApplicationConfigInjectionDelegatordelegator factory logic to cast the$configvalue to an array before passing it to itsinjectPipelineFromConfig()andinjectRoutesFromConfig()methods, ensuring it will work correctly with containers that store theconfigservice as anArrayObjectinstead of anarray.
- Nothing.
- zendframework/zend-expressive#596 updates the
ApplicationConfigInjectionDelegator::injectRoutesFromConfig()method to use the key name associated with a route specification if nonamemember is provided when creating aRouteinstance. This can help enforce name uniqueness when defining routes via configuration.
- Nothing.
- Nothing.
- Nothing.
-
zendframework/zend-expressive#543 adds support for the final PSR-15 interfaces, and explicitly depends on psr/http-server-middleware.
-
zendframework/zend-expressive#538 adds scalar and return type hints to methods wherever possible.
-
zendframework/zend-expressive#562 adds the class
Mezzio\Response\ServerRequestErrorResponseGenerator, and maps it to theMezzio\Container\ServerRequestErrorResponseGeneratorFactory. The class generates an error response when an exeption occurs producing a server request instance, and can be optionally templated. -
zendframework/zend-expressive#543 adds a new class,
Mezzio\MiddlewareContainer. The class decorates a PSR-11ContainerInterface, and adds the following behavior:- If a class is not in the container, but exists,
has()will returntrue. - If a class is not in the container, but exists,
get()will attempt to instantiate it, caching the instance locally if it is valid. - Any instance pulled from the container or directly instantiated is tested.
If it is a PSR-15
RequestHandlerInterface, it will decorate it in a laminas-stratigilityRequestHandlerMiddlewareinstance. If the instance is not a PSR-15MiddlewareInterface, the container will raise aMezzio\Exception\InvalidMiddlewareException.
- If a class is not in the container, but exists,
-
zendframework/zend-expressive#543 adds a new class,
Mezzio\MiddlewareFactory. The class composes aMiddlewareContainer, and exposes the following methods:callable(callable $middleware) : CallableMiddlewareDecoratorhandler(RequestHandlerInterface $handler) : RequestHandlerMiddlewarelazy(string $service) : LazyLoadingMiddlewareprepare($middleware) : MiddlewareInterface: accepts a string service name, callable,RequestHandlerInterface,MiddlewareInterface, or array of such values, and returns aMiddlewareInterface, raising an exception if it cannot determine what to do.pipeline(...$middleware) : MiddlewarePipe: passes each argument toprepare(), and the result toMiddlewarePipe::pipe(), returning the pipeline when complete.
-
zendframework/zend-expressive#543 adds the following factory classes, each within the
Mezzio\Containernamespace:ApplicationPipelineFactory: creates and returns aLaminas\Stratigility\MiddlewarePipeto use as the application middleware pipeline.DispatchMiddlewareFactory: creates and returns aMezzio\Router\DispatchMiddlewareinstance.EmitterFactory: creates and returns aLaminas\HttpHandlerRunner\Emitter\EmitterStackinstance composing anSapiEmitterfrom that same namespace as the only emitter on the stack. This is used as a dependency for theLaminas\HttpHandlerRunner\RequestHandlerRunnerservice.MiddlewareContainerFactory: creates and returns aMezzio\MiddlewareContainerinstance decorating the PSR-11 container passed to the factory.MiddlewareFactoryFactory: creates and returns aMezzio\MiddlewareFactoryinstance decorating aMiddlewareContainerinstance as pulled from the container.RequestHandlerRunnerFactory: creates and returns aLaminas\HttpHandlerRunner\RequestHandlerRunnerinstance, using the servicesMezzio\Application,Laminas\HttpHandlerRunner\Emitter\EmitterInterface,Mezzio\ServerRequestFactory, andMezzio\ServerRequestErrorResponseGenerator.ServerRequestFactoryFactory: creates and returns acallablefactory for generating a PSR-7ServerRequestInterfaceinstance; this returned factory is a dependency for theLaminas\HttpHandlerRunner\RequestHandlerRunnerservice.ServerRequestErrorResponseGeneratorFactory: creates and returns acallablethat accepts a PHPThrowablein order to generate a PSR-7ResponseInterfaceinstance; this returned factory is a dependency for theLaminas\HttpHandlerRunner\RequestHandlerRunnerservice, which uses it to generate a response in the scenario that theServerRequestFactoryis unable to create a request instance.
-
zendframework/zend-expressive#551 and zendframework/zend-expressive#554 add the following constants under the
Mezzionamespace:DEFAULT_DELEGATEcan be used to refer to the formerDefaultDelegateFQCN service, and maps to theMezzio\Handler\NotFoundHandlerservice.IMPLICIT_HEAD_MIDDLEWAREcan be used to refer to the formerMezzio\Middleware\ImplicitHeadMiddlewareservice, and maps to theMezzio\Router\Middleware\ImplicitHeadMiddlewareservice.IMPLICIT_OPTIONS_MIDDLEWAREcan be used to refer to the formerMezzio\Middleware\ImplicitOptionsMiddlewareservice, and maps to theMezzio\Router\Middleware\ImplicitOptionsMiddlewareservice.NOT_FOUND_MIDDLEWAREcan be used to refer to the formerMezzio\Middleware\NotFoundMiddlewareservice, and maps to theMezzio\Handler\NotFoundHandlerservice.
-
zendframework/zend-expressive#579 updates the version constraint for mezzio-router to use 3.0.0rc4 or later.
-
zendframework/zend-expressive#579 updates the version constraint for laminas-stratigility to use 3.0.0rc1 or later.
-
zendframework/zend-expressive#543 adds a dependency on zendframework/zend-httphandlerrunner 1.0.0
-
zendframework/zend-expressive#542 modifies the
composer.jsonto no longer suggest the pimple/pimple package, but rather the zendframework/zend-pimple-config package. -
zendframework/zend-expressive#542 modifies the
composer.jsonto no longer suggest the aura/di package, but rather the zendframework/zend-auradi-config package. -
zendframework/zend-expressive#543 updates the
Mezzio\ConfigProviderto reflect new, removed, and updated services and their factories. -
zendframework/zend-expressive#554 updates the
ConfigProviderto add entries for the following constants as follows:IMPLICIT_HEAD_MIDDLEWAREaliases to theMezzio\Router\Middleware\ImplicitHeadMiddlewareservice.IMPLICIT_OPTIONS_MIDDLEWAREaliases to theMezzio\Router\Middleware\ImplicitOptionsMiddlewareservice.
-
zendframework/zend-expressive#543 updates
Mezzio\Handler\NotFoundHandlerto implement the PSR-15RequestHandlerInterface. AsMezzio\Middleware\NotFoundHandleris removed,Mezzio\Container\NotFoundHandlerFactoryhas been re-purposedto create an instance ofMezzio\Handler\NotFoundHandler. -
zendframework/zend-expressive#561 modifies the
Mezzio\Handler\NotFoundHandlerto compose a response factory instead of a response prototype. -
zendframework/zend-expressive#543 refactors
Mezzio\Applicationcompletely.The class no longer extends
Laminas\Stratigility\MiddlewarePipe, and instead implements the PSR-15MiddlewareInterfaceandRequestHandlerInterface.It now requires the following dependencies via constructor injection, in the following order:
Mezzio\MiddlewareFactoryLaminas\Stratigility\MiddlewarePipe; this is the pipeline representing the application.Mezzio\Router\RouteCollectorLaminas\HttpHandlerRunner\RequestHandlerRunner
It removes all "getter" methods (as detailed in the "Removed" section of this release), but retains the following methods, with the changes described below. Please note: in most cases, these methods accept the same arguments as in the version 2 series, with the exception of callable double-pass middleware (these may be decorated manually using
Laminas\Stratigility\doublePassMiddleware()), and http-interop middleware (no longer supported; rewrite as PSR-15 middleware).-
<
10BC8
li>
pipe($middlewareOrPath, $middleware = null) : voidpasses its arguments to the composedMiddlewareFactory'sprepare()method; if two arguments are provided, the second is passed to the factory, and the two together are passed toLaminas\Stratigility\path()in order to decorate them to work as middleware. The prepared middleware is then piped to the composedMiddlewarePipeinstance.As a result of switching to use the
MiddlewareFactoryto prepare middleware, you may now pipeRequestHandlerInterfaceinstances as well. -
route(string $path, $middleware, array $methods = null, string $name) : Routepasses its$middlewareargument to theMiddlewareFactory::prepare()method, and then all arguments to the composedRouteCollectorinstance'sroute()method.As a result of switching to use the
MiddlewareFactoryto prepare middleware, you may now route toRequestHandlerInterfaceinstances as well. -
Each of
get,post,patch,put,delete, andanynow proxy toroute()after marshaling the correct$methods. -
getRoutes() : Route[]proxies to the composedRouteCollectorinstance. -
handle(ServerRequestInterface $request) : ResponseInterfaceproxies to the composedMiddlewarePipeinstance'shandle()method. -
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterfaceproxies to the composedMiddlewarePipeinstance'sprocess()method. -
run() : voidproxies to the composedRequestHandlerRunnerinstance. Please note that the method no longer accepts any arguments.
zendframework/zend-expressive#543 modifies the
Mezzio\Container\ApplicationFactory to reflect the changes to the
Mezzio\Application class as detailed above. It pulls the following
services to inject via the constructor:
Mezzio\MiddlewareFactoryLaminas\Stratigility\ApplicationPipeline, which should resolve to aMiddlewarePipeinstance; use theMezzio\Container\ApplicationPipelineFactory.Mezzio\Router\RouteCollectorLaminas\HttpHandlerRunner\RequestHandlerRunner
zendframework/zend-expressive#581
changes how the ApplicationConfigInjectionDelegator::injectPipelineFromConfig()
method works. Previously, it would auto-inject routing and dispatch middleware
if routes were configured, but no middleware_pipeline was present.
Considering that this method will always be called manually, this
functionality was removed; the method now becomes a no-op if no
middleware_pipeline is present.
zendframework/zend-expressive#568 updates the
ErrorHandlerFactory to pull the Psr\Http\Message\ResponseInterface
service, which returns a factory capable of returning a response instance,
and passes it to the Laminas\Stratigility\Middleware\ErrorHandler instance it
creates, as that class changes in 3.0.0alpha4 such that it now expects a
factory instead of an instance.
zendframework/zend-expressive#562 extracts
most logic from Mezzio\Middleware\ErrorResponseGenerator to a new
trait, Mezzio\Response\ErrorResponseGeneratorTrait. A trait was
used as the classes consuming it are from different namespaces, and thus
different inheritance trees. The trait is used by both the
ErrorResponseGenerator and the new ServerRequestErrorResponseGenerator.
zendframework/zend-expressive#551 removes
Mezzio\Container\RouteMiddlewareFactory, as mezzio-router
now provides a factory for the middleware.
zendframework/zend-expressive#551 removes
Mezzio\Container\DispatchMiddlewareFactory, as mezzio-router
now provides a factory for the middleware.
zendframework/zend-expressive#551 removes
Mezzio\Middleware\ImplicitHeadMiddleware, as it is now provided by
the mezzio-router package.
zendframework/zend-expressive#551 removes
Mezzio\Middleware\ImplicitOptionsMiddleware, as it is now provided
by the mezzio-router package.
- Nothing.
-
zendframework/zend-expressive#529 removes support for PHP versions prior to PHP 7.1.
-
zendframework/zend-expressive#529 removes support for http-interop/http-middleware (previous PSR-15 iteration).
-
zendframework/zend-expressive#543 removes support for http-interop/http-server-middleware.
-
zendframework/zend-expressive#580 removes laminas-diactoros as a requirement; all usages of it within the package are currently conditional on it being installed, and can be replaced easily with any other PSR-7 implementation at this time.
-
zendframework/zend-expressive#543 removes the class
Mezzio\Delegate\NotFoundDelegate; useMezzio\Handler\NotFoundHandlerinstead. -
zendframework/zend-expressive#546 removes the service
Mezzio\Delegate\DefaultDelegate, as there is no longer a concept of a default handler invoked by the application. Instead, developers MUST pipe a request handler or middleware at the innermost layer of the pipeline guaranteed to return a response; we recommend usingMezzio\Handler\NotFoundHandlerfor this purpose. -
zendframework/zend-expressive#543 removes the class
Mezzio\Middleware\RouteMiddleware. Use theRouteMiddlewarefrom mezzio-router instead. -
zendframework/zend-expressive#543 removes the class
Mezzio\Middleware\DispatchMiddleware. Use theDispatchMiddlewarefrom mezzio-router instead; the factoryMezzio\Container\DispatchMiddlewareFactorywill return an instance for you. -
zendframework/zend-expressive#543 removes the class
Mezzio\Emitter\EmitterStack; use the classLaminas\HttpHandlerRunner\Emitter\EmitterStackinstead. -
zendframework/zend-expressive#543 removes the following methods from
Mezzio\Application:pipeRoutingMiddleware(): usepipe(\Mezzio\Router\RouteMiddleware::class)instead.pipeDispatchMiddleware(): usepipe(\Mezzio\Router\DispatchMiddleware::class)instead.getContainer()getDefaultDelegate(): ensure you pipe middleware or a request handler capable of returning a response at the innermost layer;Mezzio\Handler\NotFoundHandlercan be used for this.getEmitter(): use theLaminas\HttpHandlerRunner\Emitter\EmitterInterfaceservice from the container.injectPipelineFromConfig(): use the newApplicationConfigInjectionDelegatorand/or the static method of the same name it defines.injectRoutesFromConfig(): use the newApplicationConfigInjectionDelegatorand/or the static method of the same name it defines.
-
zendframework/zend-expressive#543 removes the class
Mezzio\AppFactory. -
The internal
Mezzio\MarshalMiddlewareTrait,Mezzio\ApplicationConfigInjectionTrait, andMezzio\IsCallableMiddlewareTraithave been removed.
- zendframework/zend-expressive#574 updates the
classes
Mezzio\Exception\InvalidMiddlewareExceptionandMissingDependencyExceptionto implement the PSR-11ContainerExceptionInterface.
-
zendframework/zend-expressive#581 adds the class
Mezzio\ConfigProvider, and exposes it to the laminas-component-installer Composer plugin. We recommend updating yourconfig/config.phpto reference it, as well as theMezzio\Router\ConfigProvidershipped with mezzio-router versions 2.4 and up. -
zendframework/zend-expressive#581 adds the class
Mezzio\Container\ApplicationConfigInjectionDelegator. The class can act as a delegator factory, and, when enabled, will inject routes and pipeline middleware defined in configuration.Additionally, the class exposes two static methods:
injectPipelineFromConfig(Application $app, array $config)injectRoutesFromConfig(Application $app, array $config)
These may be called to modify an
Applicationinstance based on an array of configuration. See thd documentation for more details. -
zendframework/zend-expressive#581 adds the class
Mezzio\Handler\NotFoundHandler; the class takes over the functionality previously provided inMezzio\Delegate\NotFoundDelegate.
-
zendframework/zend-expressive#581 updates the minimum supported laminas-stratigility version to 2.2.0.
-
zendframework/zend-expressive#581 updates the minimum supported mezzio-router version to 2.4.0.
-
zendframework/zend-expressive#581 deprecates the following classes and traits:
-
Mezzio\AppFactory: if you are using this, you will need to switch to direct usage ofMezzio\Applicationor aLaminas\Stratigility\MiddlewarePipeinstance. -
Mezzio\ApplicationConfigInjectionTrait: if you are using it, it is marked internal, and deprecated; it will be removed in version 3. -
Mezzio\Container\NotFoundDelegateFactory: theNotFoundDelegatewill be renamed toMezzio\Handler\NotFoundHandlerin version 3, making this factory obsolete. -
Mezzio\Delegate\NotFoundDelegate: this class becomesMezzio\Handler\NotFoundHandlerin v3, and the new class is added in version 2.2 as well. -
Mezzio\Emitter\EmitterStack: the emitter concept is extracted from laminas-diactoros to a new component, laminas-httphandlerrunner. This latter component is used in version 3, and defines theEmitterStackclass. Unless you are extending it or interacting with it directly, this change should not affect you; theLaminas\Diactoros\Response\EmitterInterfaceservice will be directed to the new class in that version. -
Mezzio\IsCallableInteropMiddlewareTrait: if you are using it, it is marked internal, and deprecated; it will be removed in version 3. -
Mezzio\MarshalMiddlewareTrait: if you are using it, it is marked internal, and deprecated; it will be removed in version 3. -
Mezzio\Middleware\DispatchMiddleware: this functionality has been moved to mezzio-router, under theMezzio\Router\Middlewarenamespace. -
Mezzio\Middleware\ImplicitHeadMiddleware: this functionality has been moved to mezzio-router, under theMezzio\Router\Middlewarenamespace. -
Mezzio\Middleware\ImplicitOptionsMiddleware: this functionality has been moved to mezzio-router, under theMezzio\Router\Middlewarenamespace. -
Mezzio\Middleware\NotFoundHandler: this will be removed in version 3, where you can instead pipeMezzio\Handler\NotFoundHandlerdirectly instead. -
Mezzio\Middleware\RouteMiddleware: this functionality has been moved to mezzio-router, under theMezzio\Router\Middlewarenamespace.
-
-
zendframework/zend-expressive#581 deprecates the following methods from
Mezzio\Application:pipeRoutingMiddleware()pipeDispatchMiddleware()getContainer(): this method is removed in version 3; container access will only be via the bootstrap.getDefaultDelegate(): the concept of a default delegate is removed in version 3.getEmitter(): emitters move to a different collaborator in version 3.injectPipelineFromConfig()anddinjectRoutesFromConfig()are methods defined by theApplicationConfigInjectionTrait, which will be removed in version 3. Use theApplicationConfigInjectionDelegatorinstead.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
zendframework/zend-expressive#583 provides a number of minor fixes and test changes to ensure the component works with the mezzio-router 2.4 version. In particular, configuration-driven routes will now work properly across all versions, without deprecation notices.
-
zendframework/zend-expressive#582 fixes redirects in the documentation.
- zendframework/zend-expressive#480 updates the
ImplicitHeadMiddlewareto add a request attribute indicating the request was originally generated for aHEADrequest before delegating the request; you can now pull the attributeMezzio\Middleware\ImplicitHeadMiddleware::FORWARDED_HTTP_METHOD_ATTRIBUTEin your own middleware in order to vary behavior in these scenarios.
-
zendframework/zend-expressive#505 modifies
Mezzio\Applicationto remove implementation of__call()in favor of the following new methods:get($path, $middleware, $name = null)post($path, $middleware, $name = null)put($path, $middleware, $name = null)patch($path, $middleware, $name = null)delete($path, $middleware, $name = null)
This change is an internal implementation detail only, and will not affect existing implementations or extensions.
-
zendframework/zend-expressive#511 modifies the
NotFoundDelegateto accept an optional$layoutargument to its constructor; the value defaults tolayout::defaultif not provided. That value will be passed for thelayouttemplate variable when the delegate renders a template, allowing laminas-view users (and potentially other template systems) to customize the layout template used for reporting errors.You may provide the template via the configuration
mezzio.error_handler.layout.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#534 provides a
fix for how it detects
callablemiddleware. Previously, it relied on PHP'sis_callable(), but that function can result in false positives when provided a 2-element array where the first element is an object, as the function does not verify that the second argument is a valid method of the first. We now implement additional verifications to prevent such false positives.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- zendframework/zend-expressive#521 adds an
explicit requirement on http-interop/http-middleware
^0.4.1to the package. This is necessary as newer builds of laminas-stratigility instead depend on the metapackage webimpress/http-middleware-compatibility instead of the http-interop/http-middleware package — but middleware shipped in Mezzio requires it. This addition fixes problems due to missing http-middleware interfaces.
- zendframework/zend-expressive#508 adds
documentation covering
Mezzio\Helper\ContentLengthMiddleware, introduced in mezzio-helpers 4.1.0.
- Nothing.
- Nothing.
- zendframework/zend-expressive#479 fixes the
WhoopsErrorResponseGenerator::$whoopsdockblock Type to support Whoops 1 and 2. - zendframework/zend-expressive#482 fixes the
Application::$defaultDelegatedockblock Type. - zendframework/zend-expressive#489 fixes an
edge case in the
WhoopsErrorHandlerwhereby it would emit an error if$_SERVER['SCRIPT_NAME']did not exist. It now checks for that value before attempting to use it.
- Nothing.
- zendframework/zend-expressive#468 updates
references to
DefaultDelegate::classto instead use the string'Mezzio\Delegate\DefaultDelegate'; using the string makes it clear that the service name does not resolve to an actual class.
- Nothing.
- Nothing.
- zendframework/zend-expressive#476 fixes the
WhoopsErrorResponseGeneratorto ensure it returns a proper error status code, instead of using a200 OKstatus.
- Nothing.
- Nothing.