Composer排除特定版本
如何编写排除库的多个特定版本的需求规则?
How can you write a require rule that excludes multiple specific versions of a library?
例如我需要任何1.7。*版本的库
e.g. I have a require for any 1.7.* version of a library
"require": {
"some/lib": "~1.7"
}
但是随后我发现库中存在问题版本1.7.3并希望阻止安装,可以使用以下方法完成:
But then I find an issue with the library in version 1.7.3 and want to prevent that being installed, which can be done with:
"require": {
"some/lib": ">=1.7, <1.7.3 | >1.7.3"
}
已经变得丑陋了。然后,稍后我们会发现该库的另一个问题,并希望排除版本1.7.7。尝试执行与上述相同的语法似乎很可怕,什么是排除库的特定版本的更好方法?
Which is already getting ugly. Then later on we find another issue with the library and want to exclude version 1.7.7. Trying to do the same syntax as above seems horrible, what is a better approach to excluding specific versions of a library?
TL:DR是否有这样的语法: / p>
TL:DR is there a syntax like this:
"require": {
"some/lib": "~1.7, !1.7.3, !1.7.5"
}
有效吗?
当然,问了5分钟后就找到了答案:
Of course, found the answer 5 minutes after asking:
"require": {
"some/lib": "~1.7, !=1.7.3, !=1.7.5"
}