---
title: "Site"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-site@11.5"
source: "ApiOverview/RequestLifeCycle/RequestAttributes/Site.rst"
rendered: "2026-10-21T15:30:00+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v11 has reached end-of-life as of October 31th 2024 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Site {#typo3-request-attribute-site}

The `site` request attribute hold information about the current
site in the object `\TYPO3\CMS\Core\Site\Entity\Site`.
It is available in frontend and backend context.

Example:

```php
$site = $request->getAttribute('site');
$siteConfiguration = $site->getConfiguration();
```

> [!NOTE]
> In backend context the attribute can hold a
> `\TYPO3\CMS\Core\Site\Entity\NullSite` object when the module does not
> provide a page tree or no page in the page tree is selected.

## API {#api}

-   **class Site**

    -   *Fully qualified name:* `\TYPO3\CMS\Core\Site\Entity\Site`

    Entity representing a single site with available languages

    -   **getIdentifier()**

        Gets the identifier of this site,
        mainly used when maintaining / configuring sites.

        -   *returntype:* string

    -   **getBase()**

        Returns the base URL of this site

        -   *returntype:* Psr\\Http\\Message\\UriInterface

    -   **getRootPageId()**

        Returns the root page ID of this site

        -   *returntype:* int

    -   **getLanguages()**

        -   *returntype:* array

    -   **getAllLanguages()**

        -   *returntype:* array

    -   **getLanguageById(int $languageId)**

        Returns a language of this site, given by the sys_language_uid

        -   *param int $languageId:* the languageId
        -   *returntype:* TYPO3\\CMS\\Core\\Site\\Entity\\SiteLanguage

    -   **getDefaultLanguage()**

        -   *returntype:* TYPO3\\CMS\\Core\\Site\\Entity\\SiteLanguage

    -   **getAvailableLanguages(TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\BackendUserAuthentication $user, bool $includeAllLanguagesFlag = false, int $pageId = NULL)**

        -   *param TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\BackendUserAuthentication $user:* the user
        -   *param bool $includeAllLanguagesFlag:* the includeAllLanguagesFlag, default: false
        -   *param int $pageId:* the pageId, default: NULL
        -   *returntype:* array

    -   **getErrorHandler(int $statusCode)**

        Returns a ready-to-use error handler, to be used within the ErrorController

        -   *param int $statusCode:* the statusCode
        -   *returntype:* TYPO3\\CMS\\Core\\Error\\PageErrorHandler\\PageErrorHandlerInterface

    -   **getConfiguration()**

        Returns the whole configuration for this site

        -   *returntype:* array

    -   **getAttribute(string $attributeName)**

        Returns a single configuration attribute

        -   *param string $attributeName:* the attributeName

    -   **getRouter(TYPO3\\\\CMS\\\\Core\\\\Context\\\\Context $context = NULL)**

        Returns the applicable router for this site. This might be configurable in the future.

        -   *param TYPO3\\\\CMS\\\\Core\\\\Context\\\\Context $context:* the context, default: NULL
        -   *returntype:* TYPO3\\CMS\\Core\\Routing\\RouterInterface
