‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Routing\Router Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Routing\Router:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (protected readonly RequestContextFactory $requestContextFactory, protected readonly BackendEntryPointResolver $backendEntryPointResolver,)
 
 addRoute (string $routeIdentifier, Route $route, array $aliases=[])
 
 addRouteCollection (RouteCollection $routeCollection)
 
Route[] getRoutes ()
 
 hasRoute (string $routeName)
 
SymfonyRoute Route null getRoute (string $routeName)
 
 getRouteCollection ()
 
Route match ($pathInfo)
 
 matchResult (ServerRequestInterface $request)
 
Route matchRequest (ServerRequestInterface $request)
 

Protected Attributes

RouteCollection $routeCollection
 

Detailed Description

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.

Definition at line 39 of file Router.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Routing\Router::__construct ( protected readonly RequestContextFactory  $requestContextFactory,
protected readonly BackendEntryPointResolver  $backendEntryPointResolver 
)

Definition at line 46 of file Router.php.

Member Function Documentation

◆ addRoute()

TYPO3\CMS\Backend\Routing\Router::addRoute ( string  $routeIdentifier,
Route  $route,
array  $aliases = [] 
)

◆ addRouteCollection()

TYPO3\CMS\Backend\Routing\Router::addRouteCollection ( RouteCollection  $routeCollection)

◆ getRoute()

SymfonyRoute Route null TYPO3\CMS\Backend\Routing\Router::getRoute ( string  $routeName)

Returns a route by its identifier, or null if nothing found.

Returns
‪SymfonyRoute|Route|null

Definition at line 92 of file Router.php.

Referenced by TYPO3\CMS\Backend\Routing\RouteRedirect\resolve().

◆ getRouteCollection()

TYPO3\CMS\Backend\Routing\Router::getRouteCollection ( )

only use in Core, this should not be exposed

Definition at line 100 of file Router.php.

References TYPO3\CMS\Backend\Routing\Router\$routeCollection.

◆ getRoutes()

Route [] TYPO3\CMS\Backend\Routing\Router::getRoutes ( )

Fetch all registered routes, only use in UriBuilder. Does not care about aliases, so be careful with using this method.

Returns
Route[]

Definition at line 77 of file Router.php.

◆ hasRoute()

TYPO3\CMS\Backend\Routing\Router::hasRoute ( string  $routeName)

Definition at line 82 of file Router.php.

◆ match()

Route TYPO3\CMS\Backend\Routing\Router::match (   $pathInfo)

Tries to match a URL path with a set of routes.

Parameters
string$pathInfo‪The path info to be parsed
Returns
Route the first Route object found
Exceptions
ResourceNotFoundException‪If the resource could not be found

Definition at line 112 of file Router.php.

Referenced by TYPO3\CMS\Backend\Routing\Router\matchResult().

◆ matchRequest()

Route TYPO3\CMS\Backend\Routing\Router::matchRequest ( ServerRequestInterface  $request)

Tries to match a URI against the registered routes. Use ->matchResult() instead, as this method will be deprecated in the future.

Returns
Route the first Route object found

Definition at line 173 of file Router.php.

References TYPO3\CMS\Backend\Routing\Router\matchResult().

◆ matchResult()

TYPO3\CMS\Backend\Routing\Router::matchResult ( ServerRequestInterface  $request)

Matches a PSR-7 Request and returns a RouteResult with parameters and the resolved route.

Definition at line 130 of file Router.php.

References TYPO3\CMS\Backend\Routing\Router\match().

Referenced by TYPO3\CMS\Backend\Routing\Router\matchRequest().

Member Data Documentation

◆ $routeCollection

RouteCollection TYPO3\CMS\Backend\Routing\Router::$routeCollection
protected