All notable changes to this project will be documented in this file, in reverse chronological order by release.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #80 adds support for PHP 7.3.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #76 modifies the
RouteMiddlewareFactory
to allow specifying a string$routererviceName
to its constructor. This change allows having discrete factory instances for generating route middleware that use different router instances.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #74 fixes
an issue with the
ImplicitHeadMiddleware
where matched route parameters were not copied into the request and would cause exceptions that would normally not happen for GET requests.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #73 fixes
an issue with the
ImplicitOptionsMiddleware
whereby a path match failure was incorrectly being identified as a method match failure, triggering theImplicitOptionsMiddleware
to attempt to return a response.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #69 fixes
the exception message emitted for missing dependencies when creating a
RouteCollector
instance to refer that class.
-
#50 adds
Zend\Expressive\Router\ConfigProvider
, and registers it with the package. The class defines and returns the initial dependencies for the package. -
#50 adds factory classes for all shipped middleware. In some cases (
ImplicitHeadMiddleware
,ImplicitOptionsMiddleware
, andMethodNotAllowedMiddleware
), these rely on additional services that you will need to configure within your application in order to work properly. See each factory for details. -
#47, #50, and #64 add the
Zend\Expressive\Router\RouteCollector
class, which composes aRouterInterface
, and provides methods for defining and creating path+method based routes. It exposes the following methods:route(string $path, MiddlewareInterface $middleware, array $methods = null, string $name = null) : Route
get(string $path, MiddlewareInterface $middleware, string $name = null) : Route
post(string $path, MiddlewareInterface $middleware, string $name = null) : Route
put(string $path, MiddlewareInterface $middleware, string $name = null) : Route
patch(string $path, MiddlewareInterface $middleware, string $name = null) : Route
delete(string $path, MiddlewareInterface $middleware, string $name = null) : Route
any(string $path, MiddlewareInterface $middleware, string $name = null) : Route
-
#48 and #50 adds
Zend\Expressive\Router\Middleware\MethodNotAllowedMiddleware
. This middleware checks if the request composes aRouteResult
, and, if so, if it is due to a method failure. If neither of those conditions is true, it delegates processing of the request to the handler. Otherwise, it uses a composed response prototype in order to create a "405 Method Not Allowed" response, with anAllow
header containing the list of allowed request methods. -
#49 and #50 add the class
Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware
. This middleware will answer aHEAD
request for a given route. If no route was matched, or the route allowsHEAD
requests, it delegates to the handler. If the route does not allow aGET
request, it returns an empty response, as composed in the middleware. Otherwise, it issues aGET
request to the handler, indicating the method was forwarded for aHEAD
request, and then returns the response with an empty body. -
#49 and #50 add the class
Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware
. This middleware handlesOPTIONS
requests when a route result is present and the route does not explicitly supportOPTIONS
(and otherwise delegates to the handler). In those conditions, it returns the response composed in the middleware, with anAllow
header indicating the allowed methods. -
#53 and #58 add an abstract test case,
Zend\Expressive\Router\Test\ImplicitMethodsIntegrationTest
. Implementors ofRouterInterface
should extend this class in their own test suite to ensure that they create appropriateRouteResult
instances for each of the following cases:HEAD
request called and matches one or more known routes, but the method is not defined for any of them.OPTIONS
request called and matches one or more known routes, but the method is not defined for any of them.- Request matches one or more known routes, but the method is not allowed.
In particular, these tests ensure that implementations marshal the list of allowed HTTP methods correctly in the latter two cases.
-
#41 updates the
Route
class to provide typehints for all arguments and return values. Typehints were generally derived from the existing annotations, with the following items of particular note:- The constructor
$middleware
argument typehints on the PSR-15MiddlewareInterface
. - The
getMiddleware()
method now explicitly returns a PSR-15MiddlewareInterface
instance. getAllowedMethods()
now returns a nullablearray
.
- The constructor
-
#41 and #43 update the
RouteResult
class to add typehints for all arguments and return values, where possible. Typehints were generally derived from the existing annotations, with the following items of particular note:- The
$methods
argument tofromRouteFailure()
is now a nullable array (withnull
representing the fact that any method is allowed), without a default value. You must provide a value when creating a route failure. getAllowedMethods()
will now return['*']
when any HTTP method is allowed; this will evaluate to a validAllows
header value, and is the recommended value when any HTTP method is allowed.
- The
-
#41 updates the
RouteInterface
to add typehints for all arguments and return values. In particular, thse are now:addRoute(Route $route) : void
match(Psr\Http\Message\ServerRequestInterface $request) : RouteResult
generateUri(string $name, array $substitutions = [], array $options = []) : string
-
#47 modifies the
RouteMiddleware::$router
property to make itprotected
visibility, allowing extensions to work with it. -
#48 modifies
Zend\Expressive\Router\Route
to implement the PSR-15MiddlewareInterface
. The newprocess()
method proxies to the composed middleware. -
#48 modifies
Zend\Expressive\Router\RouteResult
to implement the PSR-15MiddlewareInterface
. The newprocess()
method proxies to the composedRoute
instance in the case of a success, and otherwise delegates to the passed handler instance. -
#48 modifies
Zend\Expressive\Router\DispatchMiddleware
to process theRouteResult
directly, instead of pulling middleware from it. -
#50 renames
Zend\Expressive\Router\RouteMiddleware
toZend\Expressive\Router\Middleware\RouteMiddleware
. -
#50 renames
Zend\Expressive\Router\DispatchMiddleware
toZend\Expressive\Router\Middleware\DispatchMiddleware
. -
#58 changes the constructor of
ImplicitHeadMiddleware
to accept aRouterInterface
instead of a response factory. Internally, this allows it to re-match the current request using theGET
method; the middleware never generates its own response any longer. -
#58 changes the logic of
Route::allowsMethod()
; it no longer returnstrue
forHEAD
orOPTIONS
requests if they are not explicitly in the list of allowed methods. -
#59 changes the behavior of the
Route
constructor: it now raises an exception if the list of HTTP methods provided to it is empty. Routes MUST have one or more HTTP methods associated. -
#60 changes the behavior of the
RouteResult::getAllowedMethods()
to allow a nullable return value; this will returnnull
if all methods are allowed.
-
#48 removes the method
Zend\Expressive\Router\RouteResult::getMatchedMiddleware()
; the method is no longer necessary, as the class now implementsMiddlewareInterface
and proxies to the underlying route. -
#58 removes the following methods from
Route
, as they are no longer used:implicitHead()
implicitOptions()
-
#53 fixes logic in the
ImplicitHeadMiddleware
andImplicitOptionsMiddleware
classes with regards to how they determine that an implicitHEAD
orOPTIONS
request (respectively) has occurred. -
#66 improves the exception message raised when a route conflict is detected to include the path, HTTP methods, and name (if available).
- Nothing.
- #63
improves the deprecation notice raised by the
Zend\Expressive\Router\Route
constructor when non-middleware interface implementations are passed for the$middleware
argument. The message not contains the path, HTTP methods, and middleware type that were used to create theRoute
instance.
- Nothing.
- Nothing.
- Nothing.
-
#54 adds the middleware
Zend\Expressive\Router\Middleware\DispatchMiddleware
andZend\Expressive\Router\Middleware\RouteMiddleware
. These are the same as the versions shipped in 2.3.0, but under a new namespace. -
#55 adds
Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware
. It is imported from zend-expressive, and implements the same functionality. -
#55 adds
Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware
. It is imported from zend-expressive, and implements the same functionality. -
#57 adds the following factories for use with PSR-11 containers:
- Zend\Expressive\Router\Middleware\DispatchMiddlewareFactory`
- Zend\Expressive\Router\Middleware\ImplicitHeadMiddlewareFactory`
- Zend\Expressive\Router\Middleware\ImplicitOptionsMiddlewareFactory`
- Zend\Expressive\Router\Middleware\RouteMiddlewareFactory`
-
#57 adds
Zend\Expressive\Router\ConfigProvider
, mapping the above factories to their respective middleware, and exposing it to zend-component-installer via the package definition.
- Nothing.
-
#56 deprecates the method
Zend\Expressive\RouteResult::getMatchedMiddleware()
, as it will be removed in version 3. If you need access to the middleware, usegetMatchedRoute()->getMiddleware()
. (In version 3, theRouteResult
is middleware, and will proxy to it.) -
#56 deprecates passing non-MiddlewareInterface instances to the constructor of
Zend\Expressive\Route
. The class now triggers a deprecation notice when this occurs, indicating the changes the developer needs to make. -
#54 deprecates the middleware
Zend\Expressive\Router\DispatchMiddleware
andZend\Expressive\Router\RouteMiddleware
. The final versions in the v3 release will be under theZend\Expressive\Router\Middleware
namespace; please use those instead. -
#55 deprecates two methods in
Zend\Expressive\Router\Route
:implicitHead()
implicitOptions()
Starting in 3.0.0, implementations will need to return route result failures that include all allowed methods when matching
HEAD
orOPTIONS
implicitly.
- Nothing.
- Nothing.
-
#46 adds two new middleware, imported from zend-expressive and re-worked for general purpose usage:
-
Zend\Expressive\Router\RouteMiddleware
composes a router and a response prototype. When processed, if no match is found due to an un-matched HTTP method, it uses the response prototype to create a 405 response with anAllow
header listing allowed methods; otherwise, it dispatches to the next middleware via the provided handler. If a match is made, the route result is stored as a request attribute using theRouteResult
class name, and each matched parameter is also added as a request attribute before delegating request handling. -
Zend\Expressive\Router\DispatchMiddleware
checks for aRouteResult
attribute in the request. If none is found, it delegates handling of the request to the handler. If one is found, it pulls the matched middleware and processes it. If the middleware is not http-interop middleware, it raises an exception.
-
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #36 adds support for http-interop/http-middleware 0.5.0 via a polyfill provided by the package webimpress/http-middleware-compatibility. Essentially, this means you can drop this package into an application targeting either the 0.4.1 or 0.5.0 versions of http-middleware, and it will "just work".
- Nothing.
- Nothing.
- Nothing.
- #32 adds
support for http-interop/http-middleware
server middleware in
Route
instances.
- Nothing.
- Nothing.
- Nothing.
- #6 modifies
RouterInterface::generateUri
to support an$options
parameter, which may pass additional configuration options to the actual router. - #21 makes the configured path definition
accessible in the
RouteResult
.
- Nothing.
- Removed
RouteResultObserverInterface
andRouteResultSubjectInterface
, as they were deprecated in 1.2.0.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #29 removes
the patch introduced with #27
and 1.3.1, as it causes
Zend\Expressive\Application
to raise exceptions regarding duplicate routes, and because some implementations, including FastRoute, also raise errors on duplication. It will be up to individual routers to determine how to handle implicit HEAD and OPTIONS support.
- Nothing.
- Nothing.
- Nothing.
- #27 fixes
the behavior of
Route
to always registerHEAD
andOPTIONS
as allowed methods; this was the original intent of #24.
-
#23 adds a new static method on the
RouteResult
class,fromRoute(Route $route, array $params = [])
, for creating a newRouteResult
instance. It also addsgetMatchedRoute()
for retrieving theRoute
instance provided to that method. Doing so allows retrieving the list of supported HTTP methods, path, and route options from the matched route. -
#24 adds two new methods to the
Route
class,implicitHead()
andimplicitOptions()
. These can be used by routers or dispatchers to determine if a match based onHEAD
orOPTIONS
requests was due to the developer specifying the methods explicitly when creating the route (theimplicit*()
methods will returnfalse
if explicitly specified).
- #23
deprecates
RouteResult::fromRouteMatch()
in favor of the newfromRoute()
method.
- Nothing.
- Nothing.
- Nothing.
- #5
deprecates both
RouteResultObserverInterface
andRouteResultSubjectInterface
. The changes introduced in zend-expressive #270 make the system obsolete. The interfaces will be removed in 2.0.0.
- Nothing.
- Nothing.
- #4 adds
RouteResultSubjectInterface
, a complement toRouteResultObserverInterface
, defining the following methods:attachRouteResultObserver(RouteResultObserverInterface $observer)
detachRouteResultObserver(RouteResultObserverInterface $observer)
notifyRouteResultObservers(RouteResult $result)
- Nothing.
- #4 removes
the deprecation notice from
RouteResultObserverInterface
.
- Nothing.
- Nothing.
- #3 deprecates
RouteResultObserverInterface
, which has been moved to theZend\Expressive
namespace and package.
- Nothing.
- #1 fixes the coveralls support to trigger after scripts, so the status of the check does not make the tests fail. Additionally, ensured that coveralls can receive the coverage report!
First stable release.
See the [Expressive CHANGELOG](https://github.com/zendframework/zend-expressive/blob/master/CHANGELOG.md] for a history of changes prior to 1.0.