在与当前目录不同的目录中运行Composer [英] Running composer in a different directory than current
问题描述
我不知道是否提出了这个问题,因为搜索发现的结果主要与移动库安装目录有关。
I don't know if this question has been asked, because searching finds results mostly about moving the libraries installation directory.
我有一个全局安装的composer命令。有没有一种方法可以运行,例如 composer install
在与当前目录不同的目录中,即指定我要在其中运行命令的目录?
I have a globally installed composer command. Is there a way to run, for example, composer install
in a different directory than current, i.e. to specify the directory in which I would like tu run the command?
例如在 / home / someuser
中,我想获得与在<$内部运行 composer install
相同的结果c $ c> / home / someuser / myproject 。当然,一种方法是简单地更改当前目录,运行composer然后返回。
E.g. being in /home/someuser
, I would like to acquire the same result as in running composer install
it inside /home/someuser/myproject
. Of course, one way would be to simply change the current directory, run composer and go back.
推荐答案
当然,尝试 composer install -h
。在那里您可以找到选项-working-dir
(或 -d
)。
Sure, try composer install -h
. There you'll find an option --working-dir
(or -d
). And that's what you're looking for.
然后运行:
composer install -d=/home/someuser/myproject
您可以在撰写者文档。
< br>
根据您的操作系统,可能需要删除 =
:
Depending on your operating system, the =
might need to be removed:
composer install -d /home/someuser/myproject
这篇关于在与当前目录不同的目录中运行Composer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!