Router implements SingletonInterface
Implementation of a class for adding routes, collecting throughout the Bootstrap to register all sorts of Backend Routes, and to fetch the main Collection in order to resolve a route (see ->match() and ->matchRequest()).
Ideally, the Router is solely instantiated and accessed via the Bootstrap, the RequestHandler and the UriBuilder.
See \TYPO3\CMS\Backend\Http\RequestHandler for more details on route matching() and Bootstrap->initializeBackendRouting().
The architecture is inspired by the Symfony Routing Component.
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $routeCollection : RouteCollection
- All routes used in the Backend
Methods
- __construct() : mixed
- addRoute() : mixed
- Adds a new route with the identifiers
- getRouteCollection() : RouteCollection
- getRoutes() : array<string|int, Route>
- Fetch all registered routes, only use in UriBuilder
- match() : Route
- Tries to match a URL path with a set of routes.
- matchRequest() : Route
- Tries to match a URI against the registered routes
Properties
$routeCollection
All routes used in the Backend
protected
RouteCollection
$routeCollection
Methods
__construct()
public
__construct() : mixed
addRoute()
Adds a new route with the identifiers
public
addRoute(string $routeIdentifier, Route $route) : mixed
Parameters
- $routeIdentifier : string
- $route : Route
getRouteCollection()
public
getRouteCollection() : RouteCollection
only use in Core, this should not be exposed
Return values
RouteCollectiongetRoutes()
Fetch all registered routes, only use in UriBuilder
public
getRoutes() : array<string|int, Route>
Return values
array<string|int, Route>match()
Tries to match a URL path with a set of routes.
public
match(string $pathInfo) : Route
Parameters
- $pathInfo : string
-
The path info to be parsed
Tags
Return values
Route —the first Route object found
matchRequest()
Tries to match a URI against the registered routes
public
matchRequest(ServerRequestInterface $request) : Route
Parameters
- $request : ServerRequestInterface
Return values
Route —the first Route object found