Composer ^ What does this symbol mean not to understand?

Source: Internet
Author: User
Tags composer install
This is the official website.
caret#

The ^ operator behaves very similarly but it sticks closer to semantic versioning, and would always allow non-breaking UPDA Tes. For example ^1.2.3 are equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards Compatib Ility. For pre-1.0 versions It also acts with safety on mind and treats ^0.3 as >=0.3.0 <0.4.0.

This was the recommended operator for maximum interoperability when writing library code.

Example: ^1.2.3
Composer

Reply content:

This is the official website.
caret#

The ^ operator behaves very similarly but it sticks closer to semantic versioning, and would always allow non-breaking UPDA Tes. For example ^1.2.3 are equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards Compatib Ility. For pre-1.0 versions It also acts with safety on mind and treats ^0.3 as >=0.3.0 <0.4.0.

This was the recommended operator for maximum interoperability when writing library code.

Example: ^1.2.3
Composer

@ Charles ~ and ^ The meaning is very close, in x.y the case is the same is represented x.y <= 版本号 < (x+1).0 , but in the case of the version number is x.y.z the difference, for example:

    • ~1.2.3Represent1.2.3 <= 版本号 < 1.3.0

    • ^1.2.3Represent1.2.3 <= 版本号 < 2.0.0

See: https://getcomposer.org/doc/a ...

Thanks @ North Moon Samurai

^ Symbolic meaning, used to match next important version

Example:

Composer.json

{    "require": {        "topthink/framework": "^5.0-rc1"    }}

The following results are performed after sudo composer install

Match to the latest important version of the Composer Library Detail page

Https://packagist.org/package ...

Another remark: Make this mistake is because of a precondition, I generally only care about the minor version number, but do not care about the correction number, so if you always specify ~X.Y and ^x.y is exactly the same, even if the library version number is the version of the X.Y.Z specification named

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.