Composer constraint tester
See exactly which versions a Composer constraint such as ^2.1, ~1.4 or >=8.1 <8.4 allows, in plain English, and test versions against it.
No account, uploads or PHP execution. Your inputs stay on this device.
Composer constraint operators, at a glance
| Constraint | Allows | Use it for |
|---|---|---|
| ^1.2.3 | >=1.2.3 <2.0.0 | The default. Any release that keeps the major version, following semantic versioning. |
| ^0.3 | >=0.3.0 <0.4.0 | Before 1.0, the minor version counts as "major", so caret is stricter. |
| ~1.2 | >=1.2.0 <2.0.0 | Tilde lets only the last digit you wrote rise. |
| ~1.2.3 | >=1.2.3 <1.3.0 | Bug fixes only. |
| 1.2.* | >=1.2.0 <1.3.0 | Same as ~1.2.0. |
| >=8.1 <8.4 | Both conditions | A space or comma means AND. |
| ^7.4 || ^8.0 | Either range | || means OR; common for "php". |
| 1.0 - 2.0 | >=1.0.0 <2.1 | Hyphen range. A partial upper bound includes all of 2.0.x. |
| ^3.0@beta | ^3.0, betas allowed | A stability flag for one package, without lowering minimum-stability. |
| 1.2.3 | Exactly 1.2.3 | Pinning. Avoid in libraries: it causes conflicts. |
Stability
Composer ranks releases as dev < alpha < beta < RC < stable. By default only stable releases are installed, even if a pre-release is inside the range. Change it for the whole project with "minimum-stability" in composer.json (usually with "prefer-stable": true), or for one package with a flag such as @beta. Branch names such as dev-main are not version ranges; they install that branch.
This tester follows the rules in the official Composer versions documentation. It explains constraints; it does not resolve a whole dependency tree. For that, run composer why-not vendor/package 2.0, as described in fixing Composer dependency conflicts.