how to install packages of composer.json code example

Example: what is ^ in version composer.json

Caret Version Range (^)
-------------------------------
For example ^1.2.3 is equivalent to >=1.2.3 <2.0.0 as none of the 
releases until 2.0 should break backwards compatibility. 
For pre-1.0 versions it also acts with safety in mind and treats 
^0.3 as >=0.3.0 <0.4.0

Tilde Version Range (~)
-------------------------------
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