使用 composer 在自定义目录中安装包

2022-01-21 00:00:00 php symfony composer-php

我看到已经有一个问题,但它没有回答这个问题

I see there is already a question but it did not answer the question

  • 如何安装作曲家包进入/src 目录?

如何在 /src 目录中安装包?

How can I install a bundle in the /src directory?

我想这样做的原因是为了开发和部署,所以

Reason I would like to do this is for development and deployment, so

  • 我不必将 Symfony 的基本代码签入我的 subversion 存储库中
  • 我可以使用 Composer 来部署

查看 Composer 文档后,我确实遇到了这个问题:

Looking over the Composer docs some more I did come across this:

  • http://getcomposer.org/doc/04-schema.md#config

vendor-dir:默认为供应商.您可以将依赖项安装到如果您愿意,可以使用不同的目录.

vendor-dir: Defaults to vendor. You can install dependencies into a different directory if you want to.

我可以在 Bundle 级别设置它吗?还是用于整体安装?

Could I set this at a Bundle level? or is this for the overall install?

  • https://github.com/composer/composer/blob/master/res/composer-schema.json

推荐答案

我知道这已经晚了,但万一有人在寻找我煞费苦心(几个小时)找到的答案:<代码>供应商目录

I know this is late, but in case anyone is searching for an answer that I painstakingly (hours and hours) found: vendor-dir

文档说:

通过设置这个变量,你可以让 composer 将依赖项安装到供应商以外的目录中

By setting this var you can make composer install the dependencies into a directory other than vendor

例子:

{
    "config": {
        "vendor-dir": "website/password/vendor/"
    }
}

来自 此文档 和 这个文档

再次,希望能为其他人节省几个小时.

Again, hope to save anyone else a couple hours.

相关文章