Reputation: 25721
How can you write a require rule that excludes multiple specific versions of a library?
e.g. I have a require for any 1.7.* version of a library
"require": {
"some/lib": "~1.7"
}
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"
}
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 is there a syntax like this:
"require": {
"some/lib": "~1.7, !1.7.3, !1.7.5"
}
that works?
Upvotes: 15
Views: 2250
Reputation: 370
This also works for me on the command line.
composer require some/lib:!=1.7.3
Quotes may be needed for complex expressions.
Upvotes: 0
Reputation: 25721
Of course, found the answer 5 minutes after asking:
"require": {
"some/lib": "~1.7, !=1.7.3, !=1.7.5"
}
Upvotes: 30