Force composer to require PHP Version between Version X and Version Y

前端 未结 6 639
孤街浪徒
孤街浪徒 2020-12-23 13:14

we have a mix of different PHP versions running on your servers (max 5.3.5) and development machines (max 5.5.9).

Now we ran into the problem that we did a \"compose

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 13:56

    What about trying the tilde operator

    Tilde Operator ~1.2 Very useful for projects that follow semantic versioning. ~1.2 is equivalent to >=1.2,<2.0. For more details, read the next section below.

    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.

    Note: Though 2.0-beta.1 is strictly before 2.0, a version constraint like ~1.2 would not install it. As said above ~1.2 only means the .2 can change but the 1. part is fixed.

    Note: The ~ operator has an exception on its behavior for the major release number. This means for example that ~1 is the same as ~1.0 as it will not allow the major number to increase trying to keep backwards compatibility.

提交回复
热议问题