Asaf Nevo
Asaf Nevo

Reputation: 11678

composer install - define directory

I'm running a shell script to execute composer install command.

my composer.json file is in /var/www/html

Is there a way I can tell composer not to run under the current directory and to run the composer.json in /var/www/html ?

This is what i've done - but it feels wrong:

cd /var/www/html && composer install

Upvotes: 4

Views: 2572

Answers (1)

Sasindu Mendis
Sasindu Mendis

Reputation: 356

You can change directory to /var/www/html and then do the composer install like so:

cd /var/www/html && composer install

UPDATE

Actually a better way to do it would be using --working-dir or -d option.

composer install -d=/var/www/html

or

composer install --working-dir=/var/www/html

Upvotes: 6

Related Questions