I’m writing a PHP application based on Symfony v6. Now I want to upgrade Symfony to the ^v6.3
composer require symfony/symfony:^6.3
./composer.json has been updated
Running composer update symfony/symfony
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires symfony/cache 6.2.*, found symfony/cache[v6.2.0, ..., v6.2.13] but the package is fixed to v6.3.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 2
- Root composer.json requires symfony/config 6.2.*, found symfony/config[v6.2.0, v6.2.5, v6.2.7, v6.2.13] but the package is fixed to v6.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 3
- Root composer.json requires symfony/console 6.2.*, found symfony/console[v6.2.0, ..., v6.2.13] but the package is fixed to v6.3.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 4
- Root composer.json requires symfony/web-profiler-bundle 6.2.*, found symfony/web-profiler-bundle[v6.2.0, ..., v6.2.13] but the package is fixed to v6.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 5
- projet 2.46.3 conflicts with symfony/symfony v6.3.4.
- projet 2.46.3 conflicts with symfony/symfony v6.3.3.
- projet 2.46.3 conflicts with symfony/symfony v6.3.2.
- projet 2.46.3 conflicts with symfony/symfony v6.3.1.
- projet 2.46.3 conflicts with symfony/symfony v6.3.0.
- projet is present at version 2.46.3 and cannot be modified by Composer
- Root composer.json requires symfony/symfony ^6.3 -> satisfiable by symfony/symfony[v6.3.0, ..., v6.3.4].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.``your text``
composer require --update-with-all-dependencies symfony/framework-bundle:^6.3
./composer.json has been updated
Running composer update symfony/framework-bundle --with-all-dependencies
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "6.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires symfony/config 6.2.*, found symfony/config[v6.2.0, v6.2.5, v6.2.7, v6.2.13] but these were not loaded, likely because it conflicts with another require.
Problem 2
- Root composer.json requires symfony/console 6.2.*, found symfony/console[v6.2.0, ..., v6.2.13] but the package is fixed to v6.3.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 3
- Root composer.json requires symfony/dependency-injection ^6.2, found symfony/dependency-injection[v6.2.0, ..., v6.3.4] but these were not loaded, likely because it conflicts with another require.
Problem 4
- Root composer.json requires symfony/web-profiler-bundle 6.2.*, found symfony/web-profiler-bundle[v6.2.0, ..., v6.2.13] but the package is fixed to v6.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 5
- doctrine/doctrine-bundle is locked to version 2.10.2 and an update of this package was not requested.
- doctrine/doctrine-bundle 2.10.2 requires symfony/config ^5.4 || ^6.0 -> found symfony/config[v5.4.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 6
- friendsofsymfony/rest-bundle is locked to version 3.5.0 and an update of this package was not requested.
- friendsofsymfony/rest-bundle 3.5.0 requires symfony/config ^4.4|^5.3|^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.3.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 7
- friendsofsymfony/user-bundle is locked to version v3.2.1 and an update of this package was not requested.
- friendsofsymfony/user-bundle v3.2.1 requires symfony/config ^4.4 || ^5.0 || ^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.0.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 8
- jms/serializer-bundle is locked to version 5.3.1 and an update of this package was not requested.
- jms/serializer-bundle 5.3.1 requires symfony/dependency-injection ^3.4 || ^4.0 || ^5.0 || ^6.0 -> found symfony/dependency-injection[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.49, v5.0.0, ..., v5.4.28, v6.0.0, ..., v6.3.4] but these were not loaded, likely because it conflicts with another require.
Problem 9
- lexik/jwt-authentication-bundle is locked to version v2.19.1 and an update of this package was not requested.
- lexik/jwt-authentication-bundle v2.19.1 requires symfony/config ^4.4|^5.3|^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.3.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 10
- sensio/framework-extra-bundle is locked to version v6.2.10 and an update of this package was not requested.
- sensio/framework-extra-bundle v6.2.10 requires symfony/config ^4.4|^5.0|^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.0.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 11
- symfony/monolog-bundle is locked to version v3.8.0 and an update of this package was not requested.
- symfony/monolog-bundle v3.8.0 requires symfony/config ~4.4 || ^5.0 || ^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.0.0, ..., v5.4.26, v6.0.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 12
- symfony/maker-bundle is locked to version v1.51.1 and an update of this package was not requested.
- symfony/maker-bundle v1.51.1 requires symfony/config ^6.3|^7.0 -> found symfony/config[v6.3.0, v6.3.2] but it conflicts with your root composer.json require (6.2.*).
Problem 13
- symfony/twig-bundle is locked to version v6.3.0 and an update of this package was not requested.
- symfony/twig-bundle v6.3.0 requires symfony/config ^6.1 -> found symfony/config[v6.1.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
Problem 14
- symfony/framework-bundle[v6.3.0, ..., v6.3.4] require symfony/config ^6.1 -> found symfony/config[v6.1.0, ..., v6.3.2] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires symfony/framework-bundle ^6.3 -> satisfiable by symfony/framework-bundle[v6.3.0, v6.3.1, v6.3.2, v6.3.4].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
composer.json
:
{
"name": "projet",
"license": "proprietary",
"type": "project",
"version": "2.46.3",
"autoload": {
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
},
"files": [
"vendor/symfony/var-dumper/Resources/functions/dump.php"
]
},
"require": {
"php": "^8.2",
"beberlei/doctrineextensions": "^1.3",
"christian-riesen/otp": "^2.0",
"doctrine/doctrine-bundle": "^2.8",
"doctrine/orm": "^2.5",
"friendsofsymfony/rest-bundle": "^3.5",
"friendsofsymfony/user-bundle": "^3.1.0",
"incenteev/composer-parameter-handler": "^2.1.5",
"jms/serializer-bundle": "^5.3",
"lesstif/php-jira-rest-client": "^2.0",
"lexik/jwt-authentication-bundle": "^2.19",
"psr/cache": "3.0",
"psr/log": "^1.1.4",
"sensio/framework-extra-bundle": "^6.2.0",
"symfony/asset": "^6.2",
"symfony/cache": "6.2.*",
"symfony/config": "6.2.*",
"symfony/console": "6.2.*",
"symfony/dependency-injection": "^6.2",
"symfony/deprecation-contracts": "^2.5",
"symfony/dotenv": "^5.3",
"symfony/flex": "^1.17",
"symfony/mime": "^6.0",
"symfony/monolog-bundle": "^3.8.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/runtime": "5.4.*",
"twig/twig": "^2.14"
},
"conflict": {
"symfony/symfony": "*"
},
"require-dev": {
"symfony/maker-bundle": "^1.48.0",
"symfony/phpunit-bridge": "^5.3",
"symfony/stopwatch": "5.4.0",
"symfony/twig-bundle": "^6.0",
"symfony/web-profiler-bundle": "6.2.*"
},
"scripts": {
"auto-scripts": [
],
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true,
"symfony/runtime": true
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"branch-alias": null,
"symfony": {
"allow-contrib": false,
"require": "6.2.*"
}
}
}
2
Answers
Since the
composer.json
contains every dependency (this is a good practice) but notsymfony/symfony
, this command fails becausesymfony/symfony
will replace all the dependencies.Instead, we can:
symfony/dotenv
to 6.3 (you used5.3
)symfony/runtime
to 6.3 (you used5.4
)symfony/deprecation-contracts
,symfony/flex
, etc.composer install
works with these dependencies:To perform a minor version update (6.2 to 6.3) it requires more than simply
composer require symfony/symfomy:~6.3
You’ll want to review the detailed process on the official Symfony Framework Website: Upgrading a Minor Version.
In summary:
composer update "symfony/*" --with-all-dependencies
With regards to your components at v5.4, you’ll need to follow the Major Version Upgrade. This will be more involved.
Also looking ahead, now would be a good time, once you’ve completed everything above, to start working on any code deprecations, because when the next major version comes along you’ll be ahead of the curve.