Reputation: 413
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.
Upvotes: 0
Views: 299
Reputation: 413
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.
Upvotes: 3