All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Replaced opis/closure with laravel/serializable-closure and implemented throughout the handler process rather than a blanket serialisation of the router.
- Further fixes for type hinting bug related to array based callables with a string class name.
- Fixed a bug introduced in 6.0.0 where an array based callable with a string class name would not be considered valid.
- Added some doc comments for clarity on array types. (@marekskopal)
- Updated
psr/http-message
to^2.0.0
.
Note: While this is a major release, there are no breaking changes to the public API. The major version bump is due to the removal of support for PHP 8.0 and below.
This being said, there are some internal changes that may affect you if you have extended the library in any way. Please test thoroughly before upgrading.
- Added full support for PHP 8.1 to 8.4.
- Ability to use a PSR-15 middleware as a controller.
- Ability to pass an array of HTTP methods to
Router::map
to create a route that matches multiple methods.- This method still accepts a string so is not a breaking change.
- Ability to add a custom key to a caching router.
- Fixes and improvements throughout for PHP 8.1 to 8.4.
- Removed support for PHP < 8.1.
- Support for named routes within groups (@Fredrik82)
- Support for
psr/container:2.0
- A cached router, a way to have a fully built router cached and resolved from cache on subsequent requests.
- Response decorators, a way to manipulate a response object returned from a matched route.
- Automatic generation of OPTIONS routes if they have not been defined.
- Minimum PHP requirement bumped to 7.2.
Router
no longer extends FastRouteRouteCollecter
.Router
constructor no longer accepts optional FastRouteRouteParser
andDataGenerator
.Router
constructor now accepts an optional FastRouteRouteCollector
.- Routes already registered with FastRoute
RouteCollector
are respected and matched.
- Routes already registered with FastRoute
- Separated route preparation from dispatch process so that the router can dispatch multiple times.
- General code improvements.
- Setting of default response headers on strategies. (Replaced by response decorators, see Added).
- Exception handlers from strategies. (Already deprecated in favour of throwable handlers).
- Official support for PHP 8.0.
- Ability to pass optional
$replacements
array toRoute::getPath
in order to build literal route path strings.
- Ability to pass JSON flags to JsonStrategy. (@pine3ree)
- Router is now a RequestHandlerInterface so can be used as a middleware itself. (@delboy1978uk)
- Route params now added as Request attributes. (@delboy1978uk)
- Exception moved to more appropriate place when shifting no middleware. (@delboy1978uk)
- Ensure group prefix is always added when adding a parent group. (@delboy1978uk)
- Fixed bug when attempting to get a container for custom strategy that is not container aware.
- Ability to add middleware to the stack as a class name so it is only instantiated when used.
- Switch to use
zendframework/zend-httphandlerrunner
as removed fromdiactoros
(@JohnstonCode)
- When adding a prefix to a group after adding routes, it is now applied to those routes. (@delboy1978uk)
- Fix to how shifting middleware is handled to prevent error triggering. (@delboy1978uk)
- Fix to ensure that when invoking FastRoute methods on League\Route all callables are converted to League\Route objects (@pgk)
- Various documentation fixes.
- Allow adding default response headers to strategies.
- Expand error handling to include Throwable.
- Fixed issue where group middleware was being dublicated on internal routes.
- JSON strategy now allows array and object returns and builds JSON response. (Thanks @willemwollebrants)
- Fixed issue where setting strategy on specific routes had no effect. (Thanks @aag)
- Fixed a bug where content-type header would not be added to response in Json Strategy.
- Increased minimum PHP version to 7.1.0
- Now implements PSR-15 middleware and request handlers.
- No longer enforces use of container, one can be used optionally.
- Strategies now return PSR-15 middleare as handlers.
- Increased types of proxy callables that can be used as controllers.
- General housekeeping and refactoring for continued improvement.
- Group level strategies now handle exceptions if a route is not matched but the request falls within the group.
- Ensure JsonStrategy handles all exceptions by default.
- Handle multiline exception messages.
- Add port condition to routes.
- Middleware execution order.
- Middleware functionality for PSR-7 compatible callables, globally to route collection or individually per route/group.
- Allow setting of strategy for a route group.
- Add UUID as default pattern matcher.
- Now depend directly on PSR-11 implementation.
- Simplified default strategies to just
Application
andJson
. - Have strategies return a middleware to add to the stack.
- Have strategies handle decoration of exceptions.
- Have JsonStrategy handle all exceptions by default.
- All routing and dispatching now built around PSR-7.
- Can now group routes with prefix and match conditions.
- Routes now stored against a specific
Route
object that describes the route. - New
dispatch
method onRouteCollection
that is a compliant PSR-7 middleware. - Additional route matching conditions for scheme and host.
- API rewrite to simplify.
- API naming improvements.
- Strategies now less opinionated about return from controller.
- Can now use any callable as a controller.
- Request object is now built by the strategy when one is not available from the container.
- General tidying and removal of unused code.
- URI variables now correctly passed to controller in
MethodArgumentStrategy
.
- Added
addPatternMatcher
method to allow custom regex shortcuts within wildcard routes. - Refactored logic around matching routes.
- Added import statements for all used objects.
- Fixed dockblock annotations.
- PSR-2 standards improvements within tests.
- Migrated from Orno\Route.