Version Constraints
Composer uses semantic versioning. Constraint operators control which updates are allowed.
Composer uses semantic versioning. Constraint operators control which updates are allowed.
"require": {
"vendor/pkg": "1.2.3", // exact
"vendor/pkg": ">=1.2 <2.0", // range
"vendor/pkg": "^1.2", // >=1.2.0 <2.0.0 (semver safe)
"vendor/pkg": "~1.2", // >=1.2.0 <1.3.0 (patch only)
"vendor/pkg": "*", // any (dangerous)
"vendor/pkg": "dev-main" // git branch
}
Prefer ^ (caret) constraints — they allow minor and patch updates but block major breaking changes.