What's better way to run Composer command via script? #10848
Replies: 3 comments 2 replies
-
This is not well supported at all, as it changes the lock file and breaks a lot of guarantees. You really should not do that IMO. Either require the extensions to be present or use "suggest" to hint people that they can use these other packages if they have extension X or Y present. |
Beta Was this translation helpful? Give feedback.
-
how
I write project intaller with initial auto configuration and optionally required packages is part of. |
Beta Was this translation helpful? Give feedback.
-
Yes, at begin a thinked about exec(PHP_BINARY. ' ' . filter_input(INPUT_SERVER, 'PHP_SELF') . ' require ' . $packageName); but later I read about SyncHelper::downloadAndInstallPackageSync(
$composer->getLoop(),
$composer->getDownloadManager()->getDownloader('zip'),
$vendorDir . DIRECTORY_SEPARATOR . $packagePath,
$package
); And now I'm wondering which approach is more kosher (: first variant - dirty, second variant - bulky |
Beta Was this translation helpful? Give feedback.
-
For example, my
composer.json
:How run
require
command inApp\Composer::postInstal()
?I want add some packages optionally, for example, install some packages only if required PHP extensions are enabled.
Beta Was this translation helpful? Give feedback.
All reactions