Composer - specify `composer.json` path

2020-04-02 06:36发布

问题:

Is it possible to specify the path to the composer.json file using the cli commands? Even better, is it possible to user a file with a different name?

回答1:

I would suggest you take a look at this: https://getcomposer.org/doc/03-cli.md#environment-variables

COMPOSER

By setting the COMPOSER env variable it is possible to set the filename of composer.json to something else.

For example:

COMPOSER=composer-other.json php composer.phar install

The generated lock file will use the same name: composer-other.lock in this example.