Composer Version Constraint Helper
Understand a Composer version constraint - ^, ~, wildcards, ranges and stability flags - and test which versions it would install.
Enter a constraint from composer.json to see exactly which versions it allows, then test real versions against it with your minimum-stability setting.
More Software Version / Package Tools
View all 9Composer resolves all packages together, so a version this tool marks installable can still be ruled out by another package's requirements.
What Is the Composer Version Constraint Helper?
It translates a Composer constraint into plain bounds and checks versions against it using Composer's own rules - including four-part versions, stability suffixes (-alpha1, -beta2, -RC1, -dev) and dev- branches.
When to Use It
- Choosing a constraint for a new requirement in
composer.json. - Working out why
composer updatewon't install a version you expected. - Moving between npm and Composer, where the same symbols behave differently.
How to Use It
- Enter a constraint, or click an example.
- Pick your project's
minimum-stability(default: stable). - List versions to test - each is marked installable, outside the constraint, or blocked by stability.
Constraint Cheat Sheet
^1.2.3→ >=1.2.3 <2.0.0;^0.3→ >=0.3.0 <0.4.0.~1.2→ >=1.2 <2.0 (the last number given may rise) - but npm's~1.2means <1.3.0.~1.2.3→ >=1.2.3 <1.3.0.1.0.*→ >=1.0 <1.1;1.0 - 2.0→ >=1.0 <2.1.- Comma or space means AND;
||means OR. @beta,@devlower the stability allowed for that package only.
Understanding the Result
"Blocked by stability" means the version number fits but it is a prerelease below your minimum-stability. Stability flags (and prerelease versions written in the constraint itself) only take effect in the root composer.json.
Limitations
No Packagist data is fetched - you supply the versions. Branch aliases and prefer-stable are not modelled. For npm ranges, use the Version Range Calculator; to compare two composer.json files, use the Dependency Version Comparator.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.