~5.0 与“5.1.*”有什么区别

what is the difference of ~5.0 to "5.1.*"

在laravel作曲家我有这个

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "laravelcollective/html": "~5.0"
    },

然后我在文档中找到 laravelcollective/html将其添加到 composer

"laravelcollective/html": "5.1.*"

如果我们使用 ~ 和 * 有什么区别? 或者我该如何阅读 "laravelcollective/html": "~5.0" 而这个 "laravelcollective/html": "5.1.*"

看看 composer documentation for ~:

... using ~ specifies a minimum version, but allows the last digit specified to go up.

所以 ~5.0 将匹配 5.05.15.2(包括像 5.0.3 这样的子版本)等,其中 5.1.* 将只匹配以 5.1 开头的版本,但不关心第三个版本标识符。

使用 ~,您可以指定如下内容:~5.1.3,您将能够获得版本 5.1.35.1.4 等,但不能获得版本 5.1.25.2.0.