Hello I am using composer.json file to load packages into my application however there are some things I would like to know. In my composer.json file I have this:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"guzzlehttp/guzzle": "~6.x",
"barryvdh/laravel-debugbar": "^2.0",
"barryvdh/laravel-cors": "0.7.x",
"tymon/jwt-auth": "1.0.0-alpha.1",
"kodeine/laravel-acl": "~1.0@dev",
"intervention/image": "^2.x",
"jenssegers/date": "^3.0"
},
I would like to know what these symbols mean: " ^ ", " ~ ", " x " next to the numbers which I know are the version numbers.
They mean that when you'll run composer update
, these packages will be updated only up to selected versions. For example, if you'll tell composer laravel/framework": "5.2.*",
, framework will never be updated to 5.3
, but only up to latest 5.2.*
The
~
operator is best explained by example:~1.2
is equivalent to>=1.2 <2.0.0
, while~1.2.3
is equivalent to>=1.2.3 <1.3.0
The
^
operator behaves very similarly but it sticks closer to semantic versioning, and will always allow non-breaking updates. For example^1.2.3
is equivalent to>=1.2.3 <2.0.0
as none of the releases until2.0
should break backwards compatibilityYou can specify a pattern with a
*
wildcard.1.0.*
is the equivalent of>=1.0 <1.1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.