Add TypoScript in your extension

Changed in version 13.1

TypoScript on a per-site basis can now be included via sites and sets.

Create TypoScript files in your extension

TypoScript files must have the ending .typoscript.

They are located in Configuration/Sets/MySet within your extension. Read more about how to provide the TypoScript as set for TYPO3 v13 and above and how to provide TypoScript for both TYPO3 v13 and v12.

  • constants.typoscript contains the constants
  • setup.typoscript contains the TypoScript setup

TypoScript provided as site set (only TYPO3 v13.1 and above)

The file structure of the extension could, for example look like this:

With the extension's TypoScript residing in EXT:my_extension/Configuration/Sets/MyExtension and the TypoScript for some optional feature in EXT:my_extension/Configuration/Sets/MyExtensionWithACoolFeature. Let us assume, that the optional feature depends on the main TypoScript.

The sets can now be defined for TYPO3 v13 as follows:

The main set of the extension

name: myvendor/my-extension
label: My Extension, main set

The sub set for an optional feature

name: myvendor/my-extension-with-a-cool-feature
label: Set for a cool feature

# This feature depends on the TypoScript and settings of the main set
  - myvendor/my-extension

TypoScript files provided by the sets

The TypoScript placed in the same folder like the set, contains your configurations.

TypoScript provided by extensions supporting TYPO3 v12.4 and v13

When an extension provides TypoScript and should be compatible with both TYPO3 v12.4 and v13, you can provide site sets but still support including the TypoScript in the sys_template record via static_file_include's.

The files in the sets are the same as in the example for TYPO3 v13 only.

The extended file structure of the extension could, for example look like this:

Only when supporting TYPO3 v12.4: Make TypoScript available for static includes

Make TypoScript available for static includes (only needed if your extensions aims to support TYPO3 v12.4):


use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

defined('TYPO3') or die();

    $extensionKey = 'my-extension';
    $versionInformation = GeneralUtility::makeInstance(Typo3Version::class);
    if ($versionInformation->getMajorVersion() < 13) {
            'My Extension, main TypoScript, always include'
            'My Extension, Cool feature'

If you include the TypoScript this way, it will not be automatically loaded. You MUST load it by adding the static include in the Web > Template module in the backend, see Include TypoScript from extensions. This has the advantage of better configurability.

This will load your constants and your setup once the template is included statically.

Make TypoScript available (always load)

Only do this, if your TypoScript must really be always loaded in your site. If this is not the case, use the method described in the previous section TypoScript provided as site set (only TYPO3 v13.1 and above).


use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

    "@import 'EXT:my_extension/Configuration/TypoScript/setup.typoscript'"

It is also possible to put your TypoScript in a file called ext_typoscript_setup.typoscript or ext_typoscript_constants.typoscript (for constants).

More information