With the rewrite of the TypoScript parser in TYPO3 v12, the parsing logic itself has been entirely marked as internal. Developers typically do not need to deal with all the nasty details and some parts of the parser are still subject to change.
Developers who really need to parse own TypoScript snippets, should have
a look at the factory classes located in
though. They are marked
@internal as well, but may be opened in the
future. Use them on your own risk at the moment.
TYPO3 already provides frontend TypoScript and TSconfig. Use these APIs for other use cases:
The page TSconfig for a specific page can be retrieved using
the parser creates a tree of PHP objects internally, this method returns only
the array representation of the parsed TypoScript:
// use TYPO3\CMS\Backend\Utility\BackendUtility; // Get the page TSconfig for the page with uid 42 $pageTsConfig = BackendUtility::getPagesTSconfig(42);
When calling a TYPO3 frontend page, TypoScript is prepared and parsed by some middlewares. They add the TypoScript request attribute.
Frontend TypoScript plays an important role to create, determine und use the correct page caches, the details in this area are pretty complex. With the continued refactoring of the frontend parsing chain, this part will evolve in the future and further API will evolve allowing extensions to parse TypoScript more easily.
However, extension controllers that need the parsed TypoScript can access the parsed setup as array:
$fullTypoScript = $request->getAttribute('frontend.typoscript')->getSetupArray();