1

What is the meaning of ~ in composer package?

example in composer.json symfony

"symfony/symfony": "~2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~2.3",
    "sensio/framework-extra-bundle": "~2.3",
    "sensio/generator-bundle": "~2.3",
GusDeCooL
  • 5,639
  • 17
  • 68
  • 102
  • possible duplicate of [What does the tilde (~) mean in my composer.json file?](http://stackoverflow.com/questions/18979729/what-does-the-tilde-mean-in-my-composer-json-file) – ztirom Dec 22 '13 at 15:57

1 Answers1

5

See http://getcomposer.org/doc/01-basic-usage.md#next-significant-release-tilde-operator-

The ~ operator is best explained by example: ~1.2 is equivalent to >=1.2,<2.0, while ~1.2.3 is equivalent to >=1.2.3,<1.3. As you can see it is mostly useful for projects respecting semantic versioning. A common usage would be to mark the minimum minor version you depend on, like ~1.2 (which allows anything up to, but not including, 2.0). Since in theory there should be no backwards compatibility breaks until 2.0, that works well. Another way of looking at it is that using ~ specifies a minimum version, but allows the last digit specified to go up.

SamV
  • 7,548
  • 4
  • 39
  • 50