Update Symfony 2.5.10 to 2.7.*


Update Symfony 2.5.10 to 2.7.*

嗨,我想更新我的项目2.5.10到2.7,但我不能这样做。我换了作曲家。json

...
"symfony/symfony": "2.7.*",
...

执行编辑器更新时显示如下异常:

作曲家更新用包信息加载编写器存储库更新依赖项(包括require-dev)

  [RuntimeException]
  Could not load package monolog/monolog in http://packagist.org: [UnexpectedValueException] Could not parse version constraint >=0.90 <3.0: Invali
  d version string "0.90 <3.0"



  [UnexpectedValueException]
  Could not parse version constraint >=0.90 <3.0: Invalid version string "0.90 <3.0"

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress
] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

这是我的作曲家。Json文件

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The '"Symfony Standard Edition'" distribution",
    "autoload": {
        "psr-4": { "": "src/", "SymfonyStandard''": "app/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.4",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle" : "~2.0@dev",
        "phpoffice/phpword": "dev-master",
        "phpoffice/phpexcel": "dev-master"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard''Composer::hookRootPackageInstall"
        ],
        "post-install-cmd": [
            "Incenteev''ParameterHandler''ScriptHandler::buildParameters",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installRequirementsFile",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::removeSymfonyStandardFiles",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev''ParameterHandler''ScriptHandler::buildParameters",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installRequirementsFile",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::removeSymfonyStandardFiles",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.7-dev"
        }
    }
}

在这个文件中,我们添加了一些变化,不知道是否正确100%

最近更新了我的站点到Symfony 2.7

首先,你少了一个逗号,即>=0.90,<3.0这应该能回答你的问题。

第二,最好的升级方式是下载Symfony标准发行包并比较composer。因为Symfony版本可能不是你唯一需要升级的东西。

第三,可能只是顺便说一下,一旦我通过composer更新了我的2.7 Symfony网站,我总是得到一个没有错误日志的白屏。我在Github上提出了这个问题,当你安装了APC缓存时,升级Sensio发行包显然会导致这个问题。重新启动Apache,清理缓存解决了这个问题。

编码快乐!

你可以像这样修改json文件的require-dev部分

"require-dev": {
    "twig/twig": "~1.5",
    "doctrine/doctrine-bundle": "~1.2",
    "doctrine/orm": "~2.2,>=2.2.3",
    "swiftmailer/swiftmailer": ">=4.3,<6.0",
    "symfony/yaml": "~2.3",
    "symfony/validator": "~2.3",
    "symfony/twig-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/web-profiler-bundle": "~2.3",
    "symfony/browser-kit": "~2.3",
    "symfony/css-selector": "~2.3",
    "symfony/process": "~2.3",
    "symfony/expression-language": "~2.4",
    "matthiasnoback/symfony-config-test": "0.*,>=0.1.1",
    "sensio/generator-bundle": "~2.3"
},

这是我的工作