Since composer 2.2 the setting allow-plugins
will be compulsory I’ve tried to push this setting through the composer config
command in the CLI but with no luck.
I’ve tried a few commands like:
composer config --json '{"allow-plugins.composer/installers":true, "allow-plugins.dealerdirect/phpcodesniffer-composer-installer": true, "allow-plugins.roots/wordpress-core-installer": true }'
composer config config.allow-plugins '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true}'
composer config --append "allow-plugins" "composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true
composer config --json "allow-plugins" '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "roots/wordpress-core-installer": true }'
All I get is error messages like ".. is not defined" or that it is an invalid value.
What I have is this:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
},
And, I need to add the settings like this:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true
}
},
Is this possible through the CLI?
You need to pass set them one by one.
composer config allow-plugins.composer/installers true
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config allow-plugins.roots/wordpress-core-installer true
Edit per conversation in comments:
OP was looking to also achieve not being prompted during the command. To do this, we must pass the --no-interaction
(or -n
) option. This can be useful when performing automation tasks.
Full Example of OP's Plugins:
composer config --no-interaction allow-plugins.composer/installerstrue
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.roots/wordpress-core-installer true