---
title: "Access TypoScript in an extension"
manual: "TypoScript Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3tsref:extdev-access-typoscript@13.4"
source: "UsingSetting/AccessTypoScriptWithExtensions.rst"
rendered: "2026-09-19T07:15:48+00:00"
---

# Access TypoScript in an extension {#extdev-access-typoscript}

> [!NOTE]
> This part is written for extension developers.

This page explains how to access TypoScript settings in an extension.

## Extbase controllers {#extbase-controllers}

In [Extbase controllers](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ExtensionArchitecture/Extbase/Reference/Controller/ActionController.html#extbase-action-controller),
[Flexform settings](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ApiOverview/FlexForms/Reading/Index.html#read-flexforms-extbase) and TypoScript settings will be
merged together. If settings exists in both, the Flexform takes precedence and overrides the TypoScript setting.
Note that both Flexform and TypoScript settings must use the convention of preceding the setting with
`settings.` (for example, `settings.threshold`).

Extbase offers some advantages: Some things work automatically out-of-the-box. However, you must stick to the
Extbase conventions ("conventions over configuration").

In order to access TypoScript settings from an Extbase controller.

1.  Use the convention of defining your TypoScript settings in `settings`

    **EXT:my_extension/Configuration/TypoScript/setup.typoscript**

    ```typoscript
    plugin.tx_myextension {
      view {
        # view settings
      }

      settings {
        key1 = value1
        key2 = value2
      }
    }

    ```
1.  Access them via `$this->settings`

    For example, in your controller:

    ```php
    $myvalue1 = $this->settings['key1'] ?? 'default';
    ```

> [!NOTE]
> **See also**
>
> -   [Extbase TypoScript configuration](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ExtensionArchitecture/Extbase/Reference/TypoScriptConfiguration.html#extbase-typoscript-configuration)

## Fluid {#fluid}

If Extbase controllers are used, `$this->settings` is automatically passed to the
[Fluid](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ApiOverview/Fluid/Index.html#fluid) template. Allowing you to access settings like this:

```xml
{settings.key1}
```

Without Extbase, a template rendered by the
[FLUIDTEMPLATE](https://docs.typo3.org/permalink/t3tsref:cobj-fluidtemplate@13.4) content object receives its
settings from the
[settings](https://docs.typo3.org/permalink/t3tsref:cobj-fluidtemplate-properties-settings@13.4) property of that
content object.

## Reading frontend TypoScript from the PSR-7 request {#extdev-access-typoscript-psr7-request}

Any class that can reach the
[PSR-7 request](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ApiOverview/RequestLifeCycle/Typo3Request.html#getting-typo3-request-object) — a content
object, a middleware, an event listener — reads the parsed frontend
TypoScript from the
[frontend.typoscript](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ApiOverview/RequestLifeCycle/RequestAttributes/FrontendTyposcript.html#typo3-request-attribute-frontend-typoscript) request
attribute:

**EXT:my_extension/Classes/SomeClass.php**

```php
$fullTypoScript = $request->getAttribute('frontend.typoscript')
    ->getSetupArray();
```

> [!NOTE]
> `\TYPO3\CMS\Core\TypoScript\FrontendTypoScript::getSetupArray()`
> throws a `RuntimeException` when the frontend was fully
> served from the page cache, because the setup is not parsed in that
> case. Content objects are not affected: whenever they are calculated,
> the setup is available.

> [!NOTE]
> **See also**
>
> -   [Frontend TypoScript in the PHP API](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/Configuration/TypoScript/PhpApi/Index.html#typoscript-access_frontend_typoscript)

## Reading page TSconfig {#extdev-access-page-tsconfig}

Page TSconfig is backend TypoScript and therefore not part of the frontend
request. It is read for a single page with
`BackendUtility::getPagesTSconfig()`, which returns the parsed TypoScript
as an array.

> [!NOTE]
> **See also**
>
> -   [Page TSconfig in the PHP API](https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/Configuration/TypoScript/PhpApi/Index.html#typoscript-access_page_tsconfig)
