简体   繁体   中英

How to locate TYPO3 Binary (typo3)

As of TYPO3 11 LTS the typo3 binary isn't located in sysext/core/bin/ anymore, at least not in composer mode, so I need to get a new way to locate the bin-dir from composer in composer mode.

Should I use the composer/composer package to parse that? I need the root composer and not the one for the TYPO3 Crawler.

if (TYPO3_COMPOSER_MODE) {
    // How to find the composer-bin dir?      
} else {
    $typo3BinaryPath = ExtensionManagementUtility::extPath('core') . 'bin/';
}

Any suggestions on how to deal with this? An option could be to add it as a setting, so it's part of the extension settings.

I went for this solution. But would be happy to hear about other/better solutions.

private function getComposerBinPath(): string
{
    $composerRootPath = Environment::getComposerRootPath();
    $composerJson = json_decode(file_get_contents($composerRootPath . '/composer.json'), true);
    $binDir = $composerJson['config']['bin-dir'] ?? 'vendor/bin';
    return $composerRootPath . '/' . $binDir . '/';
}

This is the implementation in the TYPO3 Core for the Scheduler extension.

https://github.com/TYPO3/typo3/blob/8a9c80b9d85ef986f5f369f1744fc26a6b607dda/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php#L402

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM