Running composer in a different directory than current

后端 未结 4 931
萌比男神i
萌比男神i 2021-01-31 07:04

I don\'t know if this question has been asked, because searching finds results mostly about moving the libraries installation directory.

I have a globally installed comp

相关标签:
4条回答
  • 2021-01-31 07:21

    Sure, 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 -d=/home/someuser/myproject
    

    You can find more in composer docs.


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

    composer install -d /home/someuser/myproject
    
    0 讨论(0)
  • 2021-01-31 07:32

    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.

    0 讨论(0)
  • 2021-01-31 07:33

    Run:

    cd /home/mysites/google.com
    

    Then run:

    composer require facebook/graph-sdk
    

    Above steps will open up the directory named (google.com) and install facebook Graph SDK there.

    0 讨论(0)
  • 2021-01-31 07:44

    This works for me, PHP 7.3 on ubuntu 18.04

    Install

    composer install --working-dir=/your_composer_dir

    Update

    composer update --working-dir=/your_composer_dir

    0 讨论(0)
提交回复
热议问题