Home  >  Article  >  Development Tools  >  Regarding version number definition and composer dependency version symbols ~, ^

Regarding version number definition and composer dependency version symbols ~, ^

藏色散人
藏色散人forward
2020-02-04 12:07:434429browse

The following is used by composer to introduce the version number definition and composer dependent version symbols~,^, I hope it will be helpful to friends in need!

Regarding version number definition and composer dependency version symbols ~, ^

Version format: major version number.minor version number.revision number. The increment rules of the version number are as follows:

Major version number: when you do not Compatible API modifications,

minor version number: when you make a backward compatible functional addition,

revision number: when you make a backward compatible problem correction.

The advance version number and version compilation metadata can be added to the end of "major version number. minor version number. revision number" as an extension.

Semantic version 2.0.0 https://semver.org/lang/zh-CN/

~ means that the version number can only change the last paragraph ( If it is ~x.y, the end is y, if it is ~x.y.z, the end is z)

~1.2.3 represents 1.2.3 <= version number< 1.3.0

~1.2 represents 1.2 <= version number<2.0

^ means that in addition to the major version number, the minor version number and patch version number can be changed

^1.2.3 represents 1.2.3 <= version Number < 2.0.0

Special case version number starting with 0:

^0.3.0 equals 0.3.0 <= Version number <0.4.0 Note: not <1.0 .0

Because: The rule of semantic versioning is that if the major version number starts with 0, it means that it is an unstable version (unstable). If it is in an unstable state, the minor version number is not allowed to be backward compatible.

So if you want to specify a library starting with 0, you must pay attention:

Dangerous writing: ~0.1 equals 0.1.0 <= version number<1.0.0

Insurance writing method: ^0.1 equals 0.1.0 <= Version number <0.2.0

For more composer-related technical articles, please visit the composer column: https://www.php.cn /tool/composer/

The above is the detailed content of Regarding version number definition and composer dependency version symbols ~, ^. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete