Free tool · runs in your browser

📦 Composer Version Constraint Checker

Type a Composer version constraint to see exactly which versions it allows, in plain English, and test any version against it. Works the same way as Composer itself: verified against composer/semver.

    How Composer reads it:

      Runs in your browser: what you enter is never sent anywhere. We only count anonymous usage, such as which buttons are used, to improve the tools.

      How Composer version constraints work

      Every constraint in composer.json becomes one or more ranges. ^ (caret) allows updates that don’t change the left-most non-zero number, so ^2.4 means 2.4.0 up to, but not including, 3.0.0. ~ (tilde) allows only the last number you wrote to grow: ~2.4 also means up to 3.0.0, but ~2.4.1 means up to 2.5.0. A wildcard like 2.4.* matches any 2.4 release, and a hyphen range like 1.0 - 2.0 includes every 2.0.x release.

      Separate alternatives with || and requirements that must all hold with a space or comma. Pre-releases (alpha, beta, RC) only install when your stability settings allow them.

      Choosing constraints that age well

      • Prefer ^ for libraries that follow semantic versioning: you get fixes and features without breaking changes.
      • Use ~x.y.z or an exact version for packages that break things in minor releases.
      • For PHP itself, list each major you support, e.g. "php": "^8.2 || ^9.0", and test them in CI.
      • Commit composer.lock for applications, so every environment installs the same versions.

      Frequently asked questions

      What is the difference between ^ and ~ in Composer?

      The caret ^1.2.3 allows any update that keeps the left-most non-zero part: 1.2.3 up to (not including) 2.0.0. The tilde ~1.2.3 only allows the last given part to change: 1.2.3 up to (not including) 1.3.0. ~1.2 behaves like ^1.2: 1.2.0 up to (not including) 2.0.0.

      What does ^0.3 mean in Composer?

      Below 1.0 the caret is stricter, because 0.x releases may break compatibility in a minor version: ^0.3 means 0.3.0 up to (not including) 0.4.0, and ^0.0.3 means only 0.0.3.

      How do I allow two major versions in composer.json?

      Combine two constraints with ||, for example "^8.2 || ^9.0". A single | also works. Use a space or a comma for AND, as in ">=1.0 <2.0".

      Why doesn’t my constraint install a beta or RC version?

      Composer only installs stable releases unless minimum-stability allows otherwise. Add a stability flag to one package, such as "^2.0@beta", or set "minimum-stability": "beta" with "prefer-stable": true in composer.json.