---
title: "TYPO3 request object"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:typo3-request@11.5"
source: "ApiOverview/RequestLifeCycle/Typo3Request.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).

# TYPO3 request object {#typo3-request}

The TYPO3 request object is an implementation of the PSR-7 based
`PsrHttpMessageServerRequestInterface` containing TYPO3-specific attributes.

> [!NOTE]
> **See also**
>
> [PSR-7: HTTP message interfaces](https://www.php-fig.org/psr/psr-7/)

-   [Getting the PSR-7 request object](https://docs.typo3.org/permalink/t3coreapi:getting-the-psr-7-request-object@11.5)
-   [Attributes](https://docs.typo3.org/permalink/t3coreapi:attributes@11.5)

## Getting the PSR-7 request object {#getting-typo3-request-object}

The PSR-7 based request object is available in most contexts. In some scenarios,
like [PSR-15 middlewares](https://docs.typo3.org/permalink/t3coreapi:request-handling@11.5) or backend module controllers,
the PSR-7 base request object is given as argument to the called method.

### Extbase controller {#extbase-controller}

<!-- TODO: no Markdown rendering for "versionadded" -->

The request object compatible with the PSR-7
`\Psr\Http\Message\ServerRequestInterface` is available in an
[Extbase controller](https://docs.typo3.org/permalink/t3coreapi:extbase-action-controller@11.5) via the class property
`$this->request`:

**EXT:my_extension/Classes/Controller/MyController.php**

```php
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

final class MyController extends ActionController
{
    // ...

    public function myAction(): ResponseInterface
    {
        // ...

        // Retrieve the language attribute via the request object
        $language = $this->request->getAttribute('language');

        // ...
    }
}
```

> [!NOTE]
> Prior to TYPO3 v11.3, a custom Extbase request object is available that does
> not adhere to the PSR-7 standard. If you want to stay compatible with
> TYPO3 v10 and TYPO3 v11 you have to use the [global variable](https://docs.typo3.org/permalink/t3coreapi:typo3-request-global-variable@11.5).

### ViewHelper {#viewhelper}

In a ViewHelper you can get the rendering request from the rendering context.
For this you have to rely on the fact that a
`\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext` is passed to the
ViewHelpers `renderStatic` method, even though it is declared as
`RenderingContextInterface`, which does not have the method:

**EXT:my_extension/Classes/ViewHelpers/MyViewHelper.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\ViewHelpers;

use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

final class MyViewHelper extends AbstractViewHelper
{
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
    {
        /** @var RenderingContext $renderingContext */
        $request = $renderingContext->getRequest();
    }
}

```

Note, that `RenderingContext::getRequest()` is internal and subject to
change in future versions of TYPO3.

### User function {#user-function}

In a [TypoScript user function](https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/ContentObjects/UserAndUserInt/Index.html#cobj-user) the request object
is available as third parameter of the called class method:

**EXT:my_extension/Classes/UserFunction/MyUserFunction.php**

```php
use Psr\Http\Message\ServerRequestInterface;

final class MyUserFunction
{
    public function doSomething(
        string $content,
        array $conf,
        ServerRequestInterface $request
    ): string {
        // ...

        // Retrieve the language attribute via the request object
        $language = $request->getAttribute('language');

        // ...
    }
}
```

### Data processor {#data-processor}

A [data processor](https://docs.typo3.org/permalink/t3coreapi:content-elements-custom-data-processor@11.5) receives a
reference to the `\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer`
as first argument for the `process()` method. This object provides a
`getRequest()` method:

**EXT:my_extension/Classes/DataProcessing/MyProcessor.php**

```php
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;

final class MyProcessor implements DataProcessorInterface
{
    public function process(
        ContentObjectRenderer $cObj,
        array $contentObjectConfiguration,
        array $processorConfiguration,
        array $processedData
    ): array {
        $request = $cObj->getRequest();

        // ...
    }
}
```

### Last resort: global variable {#typo3-request-global-variable}

TYPO3 provides the request object also in the global variable
`$GLOBALS['TYPO3_REQUEST']`. Whenever it is possible the request should be
retrieved within the contexts described above. But this is not always possible
by now.

When using the global variable, it should be wrapped into a getter method:

```php
// use Psr\Http\Message\ServerRequestInterface;

private function getRequest(): ServerRequestInterface
{
    return $GLOBALS['TYPO3_REQUEST'];
}
```

This way, it is only referenced once. It can be cleaned up later easily when
the request object is made available in that context in a future TYPO3 version.

## Attributes {#typo3-request-attributes}

Attributes enriches the request with further information. TYPO3 provides
attributes which can be used in custom implementations.

The attributes can be retrieved via

```php
// Get all available attributes
$allAttributes = $request->getAttributes();

// Get only a specific attribute, here the site entity in frontend context
$site = $request->getAttribute('site');
```

The request object is also available as a global variable in
`$GLOBALS['TYPO3_REQUEST']`. This is a workaround for the Core which has to
access the server parameters at places where `$request` is not available.
So, while this object is globally available during any HTTP request, it is
considered bad practice to use this global object, if the request is accessible
in another, official way. The global object is scheduled to vanish at a later
point once the code has been refactored enough to not rely on it anymore.

The following attributes are available in **frontend** context:

-   [Application type](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-application-type@11.5)
-   [Frontend controller](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-frontend-controller@11.5)
-   [Frontend user](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-frontend-user@11.5)
-   [Language](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-language@11.5)
-   [Normalized parameters](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-normalizedparams@11.5)
-   [Routing](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-routing@11.5)
-   [Site](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-site@11.5)

The following attributes are available in **backend** context:

-   [Application type](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-application-type@11.5)
-   [Normalized parameters](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-normalizedparams@11.5)
-   [Route](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-route@11.5)
-   [Site](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-site@11.5)
-   [Target](https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-target@11.5)
