Configuration Files

Files ext_tables.php and ext_localconf.php are the two most important files for the execution of extensions within TYPO3. They contain configuration used by the system on almost every request. They should therefore be optimized for speed.


ext_localconf.php is always included in global scope of the script, either frontend or backend.

Should Not Be Used For

  • While you can put functions and classes into the script, it is a really bad practice because such classes and functions would always be loaded. It is better to have them included only as needed.
  • Registering hooks or signals , XCLASSes or any simple array assignments to $GLOBALS['TYPO3_CONF_VARS'] options will not work for the following:
  • class loader
  • package manager
  • cache manager
  • configuration manager
  • log manager
  • time zone
  • memory limit
  • locales
  • stream wrapper
  • error handler

This would not work because the extension files ext_localconf.php are included ( loadTypo3LoadedExtAndExtLocalconf ) after the creation of the mentioned objects in the Bootstrap class.

Should Be Used For

These are the typical functions that extension authors should place within ext_localconf.php

  • Registering hooks or signals , XCLASSes or any simple array assignments to $GLOBALS['TYPO3_CONF_VARS'] options
  • Registering additional Request Handlers within the Bootstrap
  • Adding any PageTSconfig or Default TypoScript via ExtensionManagementUtility APIs
  • Registering Scheduler Tasks
  • Adding reports to the reports module
  • Adding slots to signals via Extbase’s SignalSlotDispatcher
  • Registering Icons to the IconRegistry
  • Registering Services via the Service API



ext_tables.php is not always included in the global scope of the frontend context.

This file is only included when

  • a TYPO3 Backend or CLI request is happening
  • or the TYPO3 Frontend is called and a valid Backend User is authenticated

This file usually gets included later within the request and after TCA information is loaded, and a Backend User is authenticated as well.


In many cases, the file ext_tables.php is no longer needed, since TCA definitions must be placed in Configuration/TCA/*.php files nowadays.

Should Not Be Used For

  • TCA configurations for new tables. They should go in Configuration/TCA/tablename.php
  • TCA overrides of existing tables. They should go in Configuration/TCA/Overrides/tablename.php

For a descriptions of the changes for TCA (compared to older TYPO3 versions), please see the blogpost “Cleaning the hood: TCA” by Andreas Fernandez

More information can be found in the blogpost “Good practices in extensions (use TYPO3 blog).


ext_tables.php is not cached. The files in Configuration/TCA are cached.

Should Be Used For

These are the typical functions that should be placed inside ext_tables.php

  • Registering of Backend modules or Backend module functions
  • Adding Context-Sensitive-Help docs via ExtensionManagementUtility API
  • Adding TCA descriptions (via ExtensionManagementUtility::addLLrefForTCAdescr() )
  • Adding table options via ExtensionManagementUtility::allowTableOnStandardPages
  • Assignments to the global configuration arrays $TBE_STYLES and $PAGES_TYPES
  • Adding new fields to User Settings (“Setup” Extension)

Best Practices for ext_tables.php and ext_localconf.php

Additionally, it is possible to extend TYPO3 in a lot of different ways (adding TCA, Backend Routes, Symfony Console Commands etc) which do not need to touch these files.

It is recommended to AVOID checks for values on TYPO3_MODE or TYPO3_REQUESTTYPE constants (e.g. if (TYPO3_MODE === 'BE') ) within these files as it limits the functionality to cache the whole systems’ configuration. Any extension author should remove the checks if not explicitly necessary, and re-evaluate if these context-depending checks could go inside the hooks / caller function directly.

It is recommended to check for the existence of the constants defined('TYPO3_MODE') or die(); at the top of ext_tables.php and ext_localconf.php files to make sure the file is executed only indirectly within TYPO3 context. This is a security measure since this code in global scope should not be executed through the web server directly as entry point.

Additionally, it is recommended to use the extension name (e.g. “tt_address”) instead of $_EXTKEY within the two configuration files as this variable will be removed in the future. This also applies to $_EXTCONF .

However, due to limitations to TER, the $_EXTKEY option should be kept within an extension’s ext_emconf.php .

See any system extension for best practice on this behaviour.

  • TYPO3\CMS\Core\Package\PackageManager::getActivePackages() contains information about whether the module is loaded as local or system type in the packagePath key, including the proper paths you might use, absolute and relative.
  • Your ext_tables.php and ext_localconf.php files must be designed in a way that they can safely be read and subsequently imploded into one single file with all the other configuration scripts!
  • You must never use a “return” statement in the files global scope - that would make the cached script concept break.
  • You must never use a “use” statement in the files global scope - that would make the cached script concept break and could conflict with other extensions.
  • You should not rely on the PHP constant __FILE__ for detection of include path of the script - the configuration might be executed from a cached script and therefore such information should be derived from e.g. \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName() or ExtensionManagementUtility::extPath() .

It is a good practice to use a directly called closure function to encapsulate all locally defined variables and thus keep them out of the surrounding scope. This avoids unexpected side-effects with files of other extensions.

The following example contains the complete code:

defined('TYPO3_MODE') or die();

(function () {
    // Add your code here