Skip to content

7.0.0

Latest

Choose a tag to compare

@philipobenito philipobenito released this 14 Jul 08:52

[7.0.0] 2026-07-14

Added

  • RouterInterface extending PSR-15 RequestHandlerInterface for Router/Cache\Router substitutability.
  • MatchResult value object and MatchStatus enum for matching routes without dispatching (#328, #352).
  • Router::match() method to inspect route matching without executing handlers.
  • Router::getRoutes() method to introspect all registered routes (#330).
  • Route::setPathVars() for dispatcher-set path parameters, separate from user-set defaults.
  • Index-based route caching with signature hash validation for cache integrity.
  • Corrupt cache auto-recovery in cached router.
  • UrlGeneratorInterface with generateUrl() for reverse routing from named routes (#355).
  • Router and Cache\Router both implement UrlGeneratorInterface.
  • DispatcherInterface (marked @internal) formalising the Router-Dispatcher contract (#359).
  • Middleware groups: defineMiddlewareGroup() and middlewareGroup() for named middleware collections on Router and RouteGroup.
  • MatchStatus::ConditionNotMet enum case distinguishing host/scheme/port condition failures from true not-found results.
  • MatchResult::conditionNotMet() named constructor and isConditionNotMet() convenience method.
  • MethodNotAllowedException::getAllowedMethods() for typed array access to allowed HTTP methods.
  • Matched Route object added as a request attribute (keyed by Route::class) during dispatch, enabling routing-aware middleware.
  • Route freezing: routes become immutable after prepareRoutes(), preventing silent post-compilation misconfiguration.
  • FreezeableInterface, FreezeableTrait, and FreezeGuard for route immutability lifecycle.
  • Optional segment support in generateUrl(): routes using FastRoute [/{param}] syntax resolve correctly with defaults from setVars() or omit the segment when unset.
  • query() route helper on Router and RouteGroup (via RouteCollectionInterface) for the HTTP QUERY method (draft-ietf-httpbis-safe-method-w-body).

Changed

  • Minimum PHP version raised to 8.3.
  • PHPStan analysis raised from level 4 to level 7 (#360).
  • Switched from PHP_CodeSniffer (PSR-12) to PHP CS Fixer (PER-CS2.0).
  • Switched from PHPUnit to Pest v4.
  • Switched from PHPUnit mocks to Mockery.
  • Test namespace changed from League\Route\ to League\Route\Test\.
  • Cached router completely redesigned: caches compiled FastRoute data (scalars only) instead of serialising the entire Router object (#353).
  • Route::setVars() now sets declaration-time defaults only; dispatcher uses setPathVars() internally (#350).
  • Route::getVars() returns merged result of default vars and path vars, with path vars taking precedence.
  • Route compilation is now request-independent: all routes compiled unconditionally, condition matching at dispatch time only.
  • Cache\Router now implements RouterInterface.
  • FileCache::getMultiple(), setMultiple(), and deleteMultiple() now throw BadMethodCallException instead of returning incorrect values.
  • Dispatcher now uses composition instead of inheriting from FastRoute\Dispatcher\GroupCountBased (#359).
  • Dispatcher constructor accepts strategy and route map at construction time instead of via setters.
  • Dispatcher no longer implements RouteConditionHandlerInterface (condition matching extracted as internal concern).
  • JsonStrategy::getOptionsCallable() returned closure now accepts (ServerRequestInterface $request, array $vars) parameters, enabling CORS-aware OPTIONS handling (#361).
  • OptionsHandlerInterface::getOptionsCallable() docblock now specifies the expected callable signature.
  • Cache signature hash upgraded from md5 to xxh128 for improved collision resistance.
  • Dispatcher switch statements replaced with match expressions for exhaustiveness checking.
  • MatchResult is now a readonly class.
  • Route::setPathVars() marked @internal (dispatcher-only operation, exempted from route freezing).

Removed

  • laravel/serializable-closure removed from hard dependencies (moved to suggest).
  • Closure wrapping removed from Route constructor.
  • BETA status removed from cached router.
  • Request-dependent route filtering removed from prepareRoutes().
  • Support for PHP 8.1 and 8.2 dropped.
  • Scrutinizer CI integration removed.
  • Dispatcher::setRouteMap() removed (route map now set via constructor).
  • Duplicate Router::processGroups() method removed (consolidated into collectGroupRoutes()).

Fixed

  • Naming a route no longer alters route registration order, which could cause a FastRoute\BadRouteException when a named static route was shadowed by a later variable route (#362, #363).