Environment

Since version 9.x the TYPO3 core includes an environment class. This class contains all environment specific information, e.g. paths within the filesystem. This implementation replaces previously used global variables and constants like PATH_site.

The fully qualified class name is \TYPO3\CMS\Core\Core\Environment. The class provides static methods to access the necessary information.

Also for testing, the initialize() method can be called to adjust the information.

getProjectPath()

The environment provides the path to the folder containing the composer.json. For projects without Composer setup, this is equal to getPublicPath().

getPublicPath()

The environment provides the path to the public web folder with index.php for TYPO3 frontend. This was previously PATH_site. For projects without Composer setup, this is equal to getProjectPath().

getVarPath()

The environment provides the path to var folder. This folder contains data like logs, sessions, locks and cache files.

For projects with Composer setup, the value is getProjectPath() . '/var', so it is outside of the web document root - not within getPublicPath().

Without Composer, the value is getPublicPath() . '/typo3temp/var', so within the web document root - a situation that is not optimal from a security point of view.

getConfigPath()

The environment provides the path to typo3conf. This folder contains TYPO3 global configuration files and folders, e.g. LocalConfiguration.php.

For projects with Composer setup, the value is getProjectPath() . '/typo3conf', so it is outside of the web document root - not within getPublicPath().

Without Composer, the value is getPublicPath() . '/typo3conf', so within the web document root - a situation that is not optimal from a security point of view.

getLabelsPath()

The environment provides the path to labels, respective l10n folder. This folder contains downloaded translation files.

For projects with Composer setup, the value is getVarPath() . '/labels', so it is outside of the web document root - not within getPublicPath().

Without Composer, the value is getPublicPath() . '/typo3conf/l10n', so within the web document root - a situation that is not optimal from a security point of view.

getCurrentScript()

The path + filename to the current PHP script.