use TYPO3\CMS\Core\Utility\GeneralUtility; $link = GeneralUtility::linkThisUrl( GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 'class="link"' ); echo $link;In this example, we're using the GeneralUtility class's getIndpEnv function to get the current URL of the page, then passing that URL along with the class attribute to linkThisUrl to generate the link. The GeneralUtility class is part of the TYPO3 core utility package, which is included with the core installation of TYPO3.