Symfony2编写器安装一个新的bundle而不更新其他依赖项

时间:2016-12-29 17:13:00

标签: php symfony composer-php

我有一个稳定的项目已经投入生产一年了,但现在是进行一些升级的时候了。我想安装一个新的捆绑包,但我不想将任何其他包更新到他们的新版本。

当我部署项目时,我会composer.phar install使用正确的版本从composer.lock文件安装供应商。这里一切都很好。

我不能composer.phar update,因为这将更新所有供应商+无论如何都会引发数百个依赖性错误。

我想只是一个新的供应商。

我的composer.json看起来像这样:

"require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "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.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~1.3",
        "sonata-project/core-bundle": "dev-master",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/datagrid-bundle": "dev-master",
        "sonata-project/classification-bundle": "dev-master",
        "sonata-project/easy-extends-bundle": "dev-master",
        "sonata-project/media-bundle": "dev-master",
        "sonata-project/intl-bundle": "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sparkling/adyen-bundle": "^0.3.4",
        "sylius/translation-bundle": "^0.15.0",
        "sylius/shipping-bundle": "^0.15.0",
        "sylius/resource-bundle": "0.15.*",
        "sylius/payment-bundle": "0.15.*",
        "winzou/state-machine-bundle": "^0.2.2",
        "sylius/currency-bundle": "^0.15.0",
        "sylius/money-bundle": "^0.15.0",
        "ddeboer/data-import-bundle": "dev-master",
        "eko/feedbundle": "1.2.5",
        "ed/blog-bundle": "v1.0.3",
        "knplabs/knp-paginator-bundle": "dev-master",
        "hwi/oauth-bundle": "^0.3.9",
        "facebook/php-sdk-v4": "^5.1",
        "friendsofsymfony/jsrouting-bundle": "^1.6",
        "knplabs/knp-snappy-bundle": "^1.3",
        "oneup/uploader-bundle": "~1.3",
        "suncat/mobile-detect-bundle": "^0.10.2",
        "friendsofsymfony/elastica-bundle": "^3.1",
        "beberlei/DoctrineExtensions": "^1.0",
        "stfalcon/tinymce-bundle": "1.0"
    },

列表中的最后一个包:"stfalcon/tinymce-bundle": "1.0"是我要安装的包。我手工添加了这个。

添加我想要做的包后:

php -d memory_limit=-1 composer.phar update stfalcon/tinymce-bundle --with-dependencies

这仍然会引发错误:

Domas@Lenovo-PC MINGW64 /c/wamp64/www/karpedeal (develop)
endenciesmemory_limit=-1 composer.phar update stfalcon/tinymce-bundle --with-depe
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package sensio/distribution-bundle == 3.0.31.0 is satisfiable by sensio/distribution-bundle[v3.0.31] but those are rejected by your minimum-stability.
  Problem 2
    - The requested package sonata-project/intl-bundle == 2.2.3.0 is satisfiable by sonata-project/intl-bundle[2.2.3] but those are rejected by your minimum-stability.
  Problem 3
    - The requested package knplabs/knp-paginator-bundle == 2.5.0.0 is satisfiable by knplabs/knp-paginator-bundle[2.5.0] but those are rejected by your minimum-stability.
  Problem 4
    - sonata-project/user-bundle dev-master conflicts with sonata-project/intl-bundle[dev-master].
    - sonata-project/intl-bundle dev-master conflicts with sonata-project/user-bundle[dev-master].
    - sonata-project/intl-bundle dev-master conflicts with sonata-project/user-bundle[dev-master].
    - Installation request for sonata-project/intl-bundle dev-master -> satisfiable by sonata-project/intl-bundle[dev-master].
    - Installation request for sonata-project/user-bundle dev-master -> satisfiable by sonata-project/user-bundle[dev-master].

我不知道还能做什么..有没有办法在没有这些问题的情况下安装新捆绑包?

3 个答案:

答案 0 :(得分:0)

它应该像从composer.json中删除它并执行:

一样简单
php composer.phar require stfalcon/tinymce-bundle:1.0

如果您仍然有任何错误,可能是由于此特定捆绑包的依赖关系冲突或与您自己的依赖项不兼容。

你绝对不应该依赖dev-master版本。对于您的应用的每个要求,请使用特定版本,例如“^ 3.10.0”。项目的主分支可能不稳定且不是最新的,特别是关于composer.json依赖项声明。通过准确的选择替换dev-master可以解决您的问题。

答案 1 :(得分:0)

Symfony2目录中的一个更简单的命令是:

composer require stfalcon/tinymce-bundle "dev-master"

我认为它应该有效,你能试试吗?

答案 2 :(得分:0)

这是安装捆绑包的最佳方式

我今天遇到了同样的问题,我使用 require 命令

安装了特定的捆绑包

喜欢:

composer require bundleName version