Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 919
Asaf Nevo Avatar asked Oct 23 '25 22:10

Asaf Nevo


1 Answers

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
like image 71
Sasindu Mendis Avatar answered Oct 27 '25 01:10

Sasindu Mendis