例如我想要:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/google/google-api-php-client.git"
}
],
"require": {
"google/apiclient": "v1-master"
}
}
在此示例中,我尝试在分支google/apiclient
上需要v1-master
。我收到错误:
[UnexpectedValueException]
Could not parse version constraint v1-master: Invalid version string "v1-master"
答案 0 :(得分:112)
您需要通过dev-
为所有dev分支(=未标记的)添加前缀。
要安装所需的分支,请使用:
composer require google/apiclient:dev-v1-master
请参阅composer docs。
答案 1 :(得分:19)
这将起作用:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/google/google-api-php-client.git"
}
],
"require": {
"google/apiclient": "dev-BRANCH_NAME"
}
}
所以模式是“ dev- *”,如果您的分支名称是“ bug-fix”,那么“ dev-bug-fix”
带命令行:
composer require google/apiclient:dev-BRANCH_NAME