如何使用 Composer 在链存储库上分叉

How To Get Fork on Chain Repositories With Composer

composer 更新没有获取我的分叉存储库。

我的项目composer.json

"require": {
    "github/repo-1": "^0.3.8",
},
"repositories": [{
        "type": "vcs",
        "url": "https://github.com/personal/repo-1"
    },
],

我的分叉 repo-1 composer.json

"require": {
    "github/repo-2": "^0.1",
},
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/personal/repo-2"
}],

将需要分叉的回购放在主 composer.json 中,并明确要求链式依赖。

我的项目composer.json

"require": {
  "github/repo-1": "^0.3.8",
  "github/repo-2": "^0.1",
},
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/personal/repo-1"
},
{
     "type": "vcs",
     "url": "https://github.com/personal/repo-2"
}],

然后运行:

composer update github/repo-1 github/repo-2

我应该用作 dev-master

"require": {
  "github/repo-1": "dev-master",
  "github/repo-2": "dev-master",
},
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/personal/repo-1"
},
{
     "type": "vcs",
     "url": "https://github.com/personal/repo-2"
}],

或 一些情况

"require": {
  "github/repo-1": "dev-master as v1.1.x-dev",
  "github/repo-2": "dev-master as v2.1.x-dev",
},
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/personal/repo-1"
},
{
     "type": "vcs",
     "url": "https://github.com/personal/repo-2"
}],