作曲家在自定义目录中安装私有存储库

composer install private repository in custom directory

我正在尝试使用 composer 安装我的私人存储库,我有我的 bitbucket 存储库的代码,它正在被克隆到 vendor/paladinstha/core

"repositories": [
    "type": "package",
    "package": {
      "name": "paladinstha/core",
      "version": "dev-master",
      "source": {
        "url": "git@bitbucket.org:paladinstha/core.git",
        "type": "git",
        "reference": "origin/master"
      },
      "autoload": {
        "psr-4": { "": "src/" }
      }
    }
  }
],

现在的文件夹结构是:

|-Modules
|-vendor
  |-paladinstha
    |-core

但我打算将其克隆到 Modules 目录中。我还尝试使用此作曲家在自定义路径中安装 docs

我在 composer.json 文件中这样设置。

"extra": {
  "installer-paths": {
    "Modules/Core": ["paladinstha/core"]
  }
},

它正在被克隆到 vendor 目录。我究竟做错了什么?谁能帮我点一盏灯。

您不能在该目录中进行克隆。 Composer 旨在下载和管理相互依赖的包。 它们都被下载到供应商文件夹中,如果它们是私有存储库也是如此。 然后,使用命名空间,您可以在项目中使用它们。

无论如何你可以指定路径,是的,但是 永远进入 vendor 目录,而不是它之外。

只有在为特定支持的包类型开发包时,您才可以在 vendor 文件夹之外指定一个目录。

这里有 the list 个受支持的软件包。

如文档中的stated

simply require composer/installers and set the appropriate type. This is common if your package is intended for a specific framework such as CakePHP, Drupal or WordPress.