Aad Mathijssen Aad Mathijssen - 3 months ago 14x
PHP Question

Use Composer CLI to add data to the extra property

According to the documentation of the

property of the composer.json schema, allows setting of "arbitrary extra data for consumption by scripts."

For scripting purposes, it would be nice if data can be added to the
property via the command-line. It have tried
composer config extra.foo bar
, but this gives the error
Setting extra.foo does not exist or is not supported by this command

So I was wondering: is there a way to use the Composer CLI to add data to the

UPDATE: Composer 1.1.0 has added supported for this feature: https://getcomposer.org/doc/03-cli.md#modifying-extra-values
Unfortunately, it is not possible to add boolean or numeric values, as each value is added as a string. See also issue #5492 of the Composer project.


There is no way, and the reason is that this usually is bound to some very specific local use case that does not apply to the general audience.

All parameters that can be influenced with composer config are listed here: https://getcomposer.org/doc/06-config.md

If you want to add data to the "extra" part, you have to edit it by hand or let your script do it in some other way.