Running composer in a different directory than current

Try composer install -h. There you'll find an option --working-dir (or -d). And that's what you're looking for.

Then run:

composer install --working-dir=/home/someuser/myproject

You can find more in composer docs.


Depending on your operating system, the = might need to be removed:

composer install --working-dir /home/someuser/myproject

In addition to the above answer from Tomáš Votruba i had to append the = charachter on OSX. So the full command would be:

composer install -d=/home/someuser/myproject

My first post on SO so was unable to simply add this as a comment.