Search code examples
phpcomposer-phplaravel-5.1laravelcollective

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


In laravel compposer i have this

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

then I found in the doucumentation laravelcollective/htmlto add this in composer

"laravelcollective/html": "5.1.*"

what is the difference if we use ~ than * ? or how do I read this "laravelcollective/html": "~5.0" and this "laravelcollective/html": "5.1.*"


Solution

  • Taking a look at the composer documentation for ~:

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

    So ~5.0 would match 5.0, 5.1, 5.2, (including sub-versions like 5.0.3) etc. where as 5.1.* would match only versions that start with 5.1, but without caring about the third version identifier.

    With ~, you could specify something like: ~5.1.3 and you would be able to get versions 5.1.3, 5.1.4, etc., but not versions 5.1.2 or 5.2.0.