Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer exclude specific versions

Tags:

composer-php

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?

like image 614
Danack Avatar asked Feb 18 '14 17:02

Danack


1 Answers

Of course, found the answer 5 minutes after asking:

"require": {
    "some/lib": "~1.7, !=1.7.3, !=1.7.5"
}
like image 144
Danack Avatar answered Sep 25 '22 14:09

Danack