Skip to content

RouteCollectionBuilder

Runtime back-end: turns a RoutePlan into the [RouteCollection, meta] pair Routing::build() already expects (the same pair the committed Routing/Generated/*Routes::addRoutes() files produce).

Neither Routing nor the Symfony UrlMatcher built from its output care that these routes came from #[Route] attributes instead of hand-generated PHP.

final class RouteCollectionBuilder

Since1.0.0
SourceRouting/Compiler/RouteCollectionBuilder.php
MethodDescription
build(RoutePlan $plan): array{0: RouteCollection, 1: array<string, array{gen_path: string, cut: bool, path: string}>}
mergeInto(RouteCollection $routes, array<string, array{gen_path: string, cut: bool, path: string}> &$meta, RoutePlan $plan): voidAdds a RoutePlan’s routes into an already-populated RouteCollection + meta pair, instead of building a fresh one.

public function build(RoutePlan $plan): array{0: RouteCollection, 1: array<string, array{gen_path: string, cut: bool, path: string}>}

ParameterTypeDescription
$planRoutePlan

Returns array{0: RouteCollection, 1: array<string, array{gen_path: string, cut: bool, path: string}>}

public function mergeInto(RouteCollection $routes, array<string, array{gen_path: string, cut: bool, path: string}> &$meta, RoutePlan $plan): void

Adds a RoutePlan’s routes into an already-populated RouteCollection + meta pair, instead of building a fresh one.

ParameterTypeDescription
$routesRouteCollection
$metaarray``<``string``, ``array{gen_path: string, cut: bool, path: string}``>
$planRoutePlan