也许我对Composer的工作原理完全错误,但考虑到以下composer.json
(Symfony的一部分,这里没有显示一些额外的要求):
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "dev-master",
"doctrine/dbal": "dev-master",
"doctrine/doctrine-bundle": "dev-master",
"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": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
// my requirements here
}
当我运行composer update
时,我得到symfony / symfony 2.5而不是~2.4(即AFAIK 2.4.1,2.4.2等)。
答案 0 :(得分:10)
~2.4
相当于>=2.4,<3.0
。如果您想留在2.4.x
分支机构,则必须使用2.4.*
。
您可以在Composer的文档页面上阅读有关版本号的更多信息:https://getcomposer.org/doc/01-basic-usage.md#package-versions