Composer排除特定版本 [英] Composer exclude specific versions

查看:63
本文介绍了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"
}

这篇关于Composer排除特定版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆