Composer, a dependency manager for PHP, uses specific versioning rules that can sometimes be challenging to remember. This comprehensive cheatsheet is designed to help you understand and apply these rules effectively.
"require": {
// Exact version to 1.5.4
"vendor/package": "1.5.4",
// Greater or lower bounds
"vendor/package": ">=1.5.0", // Anything above 1.5.0
"vendor/package": "<1.5.0", // Anything below 1.5.0
// Wildcard
"vendor/package": "1.5.*", // >=1.5 <1.6
// Next significant release
"vendor/package": "~1.5", // >=1.5 <2.0.0
"vendor/package": "~1.5.2", // >=1.5.2 <1.6.0
// Next release, major version fixed
"vendor/package": "^1.5.2", // >=1.5.2 <2.0.0
"vendor/package": "^0.5.2", // >=0.5.2 <0.6.0
}