AttributeRouting
Opt-in Routing implementation: builds its RouteCollection + meta by scanning #[Route] attributes on action classes instead of a committed Routing/Generated/ tree.
An app switches to attribute routing by extending this (or using it directly) in place of its own generated-routes subclass. A future routes:compile artifact is expected to supersede the live scan done here for production, with this remaining the always-correct fallback.
Synopsis
Section titled “Synopsis”class AttributeRouting extends Routing
| Extends | Routing |
| Since | 1.0.0 |
| Source | Routing/AttributeRouting.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getDiagnostics(): array<Diagnostic> |
getDiagnostics()
Section titled “getDiagnostics()”public function getDiagnostics(): array<Diagnostic>
Returns array``<Diagnostic> — Diagnostics recorded while scanning for routes.
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
addRoute() | Routing | Add a route dynamically. |
exportRoutes() | Routing | Export current routing definition (RouteCollection + meta) so RoutingMiddleware can wire it up for dispatch, and so it can be round-tripped back through importRoutes(). |
gen() | Routing | URL generation. |
genSelf() | Routing | |
getBaseHref() | Routing | Return the absolute origin (scheme://host[:port]) without trailing slash. |
getBasePath() | Routing | Returns the path generated URLs are rooted at. |
getMeta() | Routing | |
getRequestContext() | Routing | Returns the Symfony request context matching and URL generation run against. |
getRoute() | Routing | Retrieve a single route meta entry or null. |
getRouteCollection() | Routing | Returns the Symfony route collection the routing matches and generates against. |
importRoutes() | Routing | Import an entire RouteCollection + meta array, replacing current state. |
initialize() | Routing | Legacy initialize() hook – stores Context & parameters and marks initialized. |
isEnabled() | Routing | Indicates whether routing should be considered enabled (subclasses override). |
match() | Routing | |
parseRouteString() | Routing | |
reset() | Routing | Reset state for worker reuse (FrankenPHP etc). |
startup() | Routing | Legacy startup() hook. |