‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Routing\SiteMatcher Class Reference
Inheritance diagram for TYPO3\CMS\Core\Routing\SiteMatcher:

Public Member Functions

 __construct (protected readonly Features $features, protected readonly SiteFinder $finder, protected readonly RequestContextFactory $requestContextFactory)
 refresh ()
 matchRequest (ServerRequestInterface $request)
 matchByPageId (int $pageId, ?array $rootLine=null)

Protected Member Functions

 getRouteCollectionForAllSites ()
positive int resolvePageIdQueryParam (ServerRequestInterface $request)
positive int resolveLanguageIdQueryParam (ServerRequestInterface $request)
 canonicalizeUri (UriInterface $uri, ServerRequestInterface $request)
 matchSiteByUri (UriInterface $uri, ServerRequestInterface $request)
 matchSiteByQueryParams (int $pageId, int $languageId, SiteRouteResult $fallback, UriInterface $uri,)

Detailed Description

Returns a site based on a given request.

The main usage is the ->matchRequest() functionality, which receives a request object and boots up Symfony Routing to find the proper route with its defaults / attributes.

On top, this is also commonly used throughout TYPO3 to fetch a site by a given pageId. ->matchPageId().

The concept of the SiteMatcher is to resolve, and not build URIs. On top, it is a facade to hide the dependency to symfony and to not expose its logic.

Please note that the site matcher will be probably cease to exist and adapted to the SiteFinder concept when Pseudo-Site handling will be removed.

Definition at line 51 of file SiteMatcher.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Routing\SiteMatcher::__construct ( protected readonly Features  $features,
protected readonly SiteFinder  $finder,
protected readonly RequestContextFactory  $requestContextFactory 

Definition at line 53 of file SiteMatcher.php.

Member Function Documentation

◆ canonicalizeUri()

TYPO3\CMS\Core\Routing\SiteMatcher::canonicalizeUri ( UriInterface  $uri,
ServerRequestInterface  $request 

Remove script file name (index.php) from request uri

Definition at line 213 of file SiteMatcher.php.

Referenced by TYPO3\CMS\Core\Routing\SiteMatcher\matchRequest().

◆ getRouteCollectionForAllSites()

TYPO3\CMS\Core\Routing\SiteMatcher::getRouteCollectionForAllSites ( )

Returns a Symfony RouteCollection containing all routes to all sites.

Definition at line 141 of file SiteMatcher.php.

References TYPO3\CMS\Webhooks\Message\$identifier.

Referenced by TYPO3\CMS\Core\Routing\SiteMatcher\matchSiteByUri().

◆ matchByPageId()

TYPO3\CMS\Core\Routing\SiteMatcher::matchByPageId ( int  $pageId,
?array  $rootLine = null 

If a given page ID is handed in, a Site/NullSite is returned.

int$pageId‪uid of a page in default language
array | null$rootLine‪an alternative root line, if already at and.

Definition at line 129 of file SiteMatcher.php.

◆ matchRequest()

TYPO3\CMS\Core\Routing\SiteMatcher::matchRequest ( ServerRequestInterface  $request)

First, it is checked, if a "id" GET/POST parameter is found. If it is, we check for a valid site mounted there.

If it isn't the quest continues by validating the whole request URL and validating against all available site records (and their language prefixes).


Definition at line 83 of file SiteMatcher.php.

References TYPO3\CMS\Core\Routing\SiteMatcher\canonicalizeUri(), TYPO3\CMS\Core\Routing\SiteMatcher\matchSiteByQueryParams(), TYPO3\CMS\Core\Routing\SiteMatcher\matchSiteByUri(), TYPO3\CMS\Core\Routing\SiteMatcher\resolveLanguageIdQueryParam(), and TYPO3\CMS\Core\Routing\SiteMatcher\resolvePageIdQueryParam().

◆ matchSiteByQueryParams()

TYPO3\CMS\Core\Routing\SiteMatcher::matchSiteByQueryParams ( int  $pageId,
int  $languageId,
SiteRouteResult  $fallback,
UriInterface  $uri 

Definition at line 254 of file SiteMatcher.php.

Referenced by TYPO3\CMS\Core\Routing\SiteMatcher\matchRequest().

◆ matchSiteByUri()

TYPO3\CMS\Core\Routing\SiteMatcher::matchSiteByUri ( UriInterface  $uri,
ServerRequestInterface  $request 

◆ refresh()

TYPO3\CMS\Core\Routing\SiteMatcher::refresh ( )

Only used when a page is moved but the pseudo site caches has this information hard-coded, so the caches need to be flushed.


Definition at line 66 of file SiteMatcher.php.

References TYPO3\CMS\Core\Utility\RootlineUtility\RUNTIME_CACHE_TAG.

◆ resolveLanguageIdQueryParam()

positive int TYPO3\CMS\Core\Routing\SiteMatcher::resolveLanguageIdQueryParam ( ServerRequestInterface  $request)

◆ resolvePageIdQueryParam()

positive int TYPO3\CMS\Core\Routing\SiteMatcher::resolvePageIdQueryParam ( ServerRequestInterface  $request)