执行composer install命令时Symfony依赖冲突问题求助
symfony/cache ^4.0 Hey there, let's break down and resolve this dependency conflict you're hitting when running php composer.phar install.
Root Cause of the Conflict
Your project uses symfony/symfony: 3.4.* — this is the full-stack Symfony framework package, which includes all core Symfony components (including symfony/cache) at version 3.4. However, you've explicitly added symfony/cache: ^4.0 to your require section. Composer can't reconcile these two requirements because Symfony 3.4's full-stack package is incompatible with 4.x versions of individual core components.
Step-by-Step Fix
Remove the standalone
symfony/cachedependency
Sincesymfony/symfony:3.4.*already includes the cache component matching the 3.4 framework version, you don't need to declare it separately.Adjust other 4.x component constraints to match Symfony 3.4
You also have other components set to 4.x versions that will conflict with 3.4:symfony/expression-language: ^4.0→ change to^3.4symfony/ldap: ^4.1→ change to^3.4
Modified require Section
Here's how your updated composer.json require section should look:
{ "php": ">=7.0", "alcaeus/mongo-php-adapter": "^1.1", "doctrine/doctrine-bundle": "^1.9", "doctrine/doctrine-fixtures-bundle": "3.0.2", "doctrine/mongodb-odm": "^1.1.7", "doctrine/mongodb-odm-bundle": "^3.4.0", "firebase/php-jwt": "^5.0", "friendsofsymfony/jsrouting-bundle": "^2.2", "friendsofsymfony/oauth-server-bundle": "dev-master", "friendsofsymfony/rest-bundle": "^2.3", "gedmo/doctrine-extensions": "^2.4", "guzzlehttp/guzzle": "^6.3", "incenteev/composer-parameter-handler": "^2.1", "jms/serializer-bundle": "~2.3", "league/omnipay": "^3.0", "nelmio/cors-bundle": "^1.5", "omnipay/stripe": "dev-patch-1", "phramz/doctrine-annotation-scanner": "^1.0", "ramsey/uuid": "^3.8", "sensio/distribution-bundle": "^5.0.19", "sensio/framework-extra-bundle": "^5.1", "symfony/assetic-bundle": "^2.8", "symfony/expression-language": "^3.4", "symfony/ldap": "^3.4", "symfony/monolog-bundle": "^3.1.0", "symfony/polyfill-apcu": "^1.0", "symfony/swiftmailer-bundle": "^3.2", "symfony/symfony": "3.4.*", "twig/twig": "^1.0||^2.0" }
Final Steps
After updating your composer.json, run the following command to resolve and install the compatible dependencies:
php composer.phar install
内容的提问来源于stack exchange,提问作者hame-dhib

