将symfony 2.1升级到2.3 composer.json

时间:2014-01-14 16:34:29

标签: symfony composer-php

我正在尝试从2.1升级到2.3但是却出现了作曲家错误:

Your requirements could not be resolved to an installable set of packages.

我尝试在没有捆绑的情况下首先升级框架,在composer.json中使用“symfony / symfony”替换“symfony / symfony”:“2.1。”:“2.3。”并运行 php composer.phar更新symfony / symfony
它没有用,所以我尝试先更新jms / security-extra-bundle,但它不起作用

php composer.phar update

既不起作用,我也试过“symfony / symfony”:“2.2。*”以及

这里是我的composer.json,我该怎么改变?

{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.1.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.0.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.1.*",
    "symfony/monolog-bundle": "2.1.*",
    "sensio/distribution-bundle": "2.1.*",
    "sensio/framework-extra-bundle": "2.1.*",
    "sensio/generator-bundle": "2.1.*",
    "jms/security-extra-bundle": "dev-master",
    "jms/di-extra-bundle": "dev-master",
    "jms/serializer-bundle": "dev-master",
    "friendsofsymfony/user-bundle": "*",
    "vich/geographical-bundle": "*",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "friendsofsymfony/rest-bundle": "*",
    "friendsofsymfony/comment-bundle": "*",
    "friendsofsymfony/jsrouting-bundle": "1.0.3",
    "servergrove/shell-alias-bundle": "dev-master",
    "beberlei/DoctrineExtensions": "dev-master",
    "stof/doctrine-extensions-bundle": "dev-master"
},
"scripts": {
    "post-install-cmd": [
        "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": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"minimum-stability": "dev",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install":"symlink"
}

}

1 个答案:

答案 0 :(得分:3)

将以下软件包的版本限制更改为2.3:

  • 的symfony / symfony的
  • 学说/教义束
  • 的symfony / assetic束
  • 的symfony / swiftmailer束
  • 的symfony /独白束
  • SENSIO /分发束
  • SENSIO /框架-额外束
  • SENSIO /发电机束

其他包装

  • friendsofsymfony / jsrouting-bundle:1.5。*

您还需要添加以下包:

  • incenteev /作曲家参数处理程序

然后需要post-install-cmdpost-update-cmd数组作为第一个命令

"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",

应为供应商可执行文件提供config.bin-dir定义

"config": {
    "bin-dir": "bin"
},

由于Symfony 2.3是LTS版本(长期支持),您可以将minimum-stability设置更改为stable,也可以选择稳定的软件包

"prefer-stable": true,

所以你的composer.json文件应如下所示:

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",

        "jms/security-extra-bundle": "dev-master",
        "jms/di-extra-bundle": "dev-master",
        "jms/serializer-bundle": "dev-master",
        "friendsofsymfony/user-bundle": "*",
        "vich/geographical-bundle": "*",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "friendsofsymfony/rest-bundle": "*",
        "friendsofsymfony/comment-bundle": "*",
        "friendsofsymfony/jsrouting-bundle": "1.5.*",
        "servergrove/shell-alias-bundle": "dev-master",
        "beberlei/DoctrineExtensions": "dev-master",
        "stof/doctrine-extensions-bundle": "dev-master"
    },
    "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"
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "symlink"
    }
}