将Symfony2 2.3升级到2.4:更改composer.json

len*_*nko 5 php symfony composer-php

我想将项目从Symfony 2.3升级到2.4.我已经知道2.4版本具有与2.3的向后兼容性,并且只需要更新de组件版本.

这是我的composer.json:

{
    "name" : "symfony/framework-standard-edition",
    "description" : "The \"Symfony Standard Edition\" distribution",
    "type" : "project",
    "license" : [
            "MIT"
    ],
    "require" : {
            "symfony/symfony" : "2.3.*",
            "doctrine/doctrine-fixtures-bundle" : "dev-master",
            "symfony/swiftmailer-bundle" : "2.3.*",
            "doctrine/orm" : ">=2.2.3,<2.4-dev",
            "doctrine/data-fixtures" : "dev-master",
            "symfony/assetic-bundle" : "2.3.*",
            "incenteev/composer-parameter-handler" : "~2.0",
            "twig/extensions" : "1.0.*",
            "php" : ">=5.3.3",
            "sensio/generator-bundle" : "2.3.*",
            "symfony/monolog-bundle" : "2.4.*",
            "sensio/framework-extra-bundle" : "2.3.*",
            "doctrine/doctrine-bundle" : "1.2.*",
            "sensio/distribution-bundle" : "2.3.*",
            "liip/imagine-bundle": "dev-master",
            "egeloen/google-map-bundle": "*"
    },
    "autoload" : {
            "psr-0" : {
                    "" : "src/"
            }
    },
    "minimum-stability" : "stable",
    "config" : {
            "bin-dir" : "bin"
    },
    "scripts" : {
            "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"
            ],
            "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"
            ]
    },
    "extra" : {
            "branch-alias" : {
                    "dev-master" : "2.3-dev"
            },
            "symfony-web-dir" : "web",
            "symfony-app-dir" : "app",
            "incenteev-parameters" : {
                    "file" : "app/config/parameters.yml"
            }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是当我检查v2.4 composer.json文件与此有很大不同.

我试图改变我的composer.json为2.4版本,添加我的自定义包并进行"作曲家更新",但它没有用.

是否足以在我自己的composer.json上更新安装2.4版本的软件包的版本?

谢谢.

Vic*_*sky 2

接下来是新的 Symfony 2.4 Composer.json 文件:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "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",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "scripts": {
        "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"
        ],
        "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"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "beta",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.4-dev"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

将您在项目中使用的require部分中的第三方库与 v 2.4 中的第三方库进行比较。如果您在新版本中不使用任何丢失的库,则可以更新。但之前创建一个备份。