Routing 

Frontend 

The routing frontend request attribute provides routing information in the object \TYPO3\CMS\Core\Routing\PageArguments . If you want to know the current page ID or retrieve the query parameters this attribute is your friend.

Example:

/** @var \Psr\Http\Message\ServerRequestInterface $request */
$pageArguments = $request->getAttribute('routing');
$pageId = $pageArguments->getPageId();
Copied!

API 

class PageArguments
Fully qualified name
\TYPO3\CMS\Core\Routing\PageArguments

Contains all resolved parameters when a page is resolved from a page path segment plus all fragments.

areDirty()
Returns
bool
getRouteArguments()
Returns
array<string,string|array>
getPageId()
Returns
int
getPageType()
Returns
string
get(string $name)
param $name

the name

Returns
string|array<string,string|array>|null
getArguments()
Returns
array<string,string|array>
getStaticArguments()
Returns
array<string,string|array>
getDynamicArguments()
Returns
array<string,string|array>
getQueryArguments()
Returns
array<string,string|array>
offsetExists(?mixed $offset)
param $offset

the offset

Returns
bool
offsetGet(?mixed $offset)
param $offset

the offset

Returns
string|array<string,string|array>|null
offsetSet(?mixed $offset, ?mixed $value)
param $offset

the offset

param $value

the value

offsetUnset(?mixed $offset)
param $offset

the offset

Backend 

New in version 12.1

The routing backend request attribute provides routing information in the object \TYPO3\CMS\Backend\Routing\RouteResult .

Example:

/** @var \Psr\Http\Message\ServerRequestInterface $request */
$routing = $request->getAttribute('routing');
$arguments = $routing->getArguments()
Copied!

API 

class RouteResult
Fully qualified name
\TYPO3\CMS\Backend\Routing\RouteResult

A route result for the TYPO3 Backend Routing, containing the matched Route and the related arguments found in the URL

getRoute()
Returns
TYPO3CMSBackendRoutingRoute
getRouteName()
Returns
string
getArguments()
Returns
array
offsetExists(?mixed $offset)
param $offset

the offset

Returns
bool
offsetGet(?mixed $offset)
param $offset

the offset

Returns
?mixed
offsetSet(?mixed $offset = '', ?mixed $value = '')
param $offset

the offset, default: ''

param $value

the value, default: ''

offsetUnset(?mixed $offset)
param $offset

the offset