Я пишу PHP-приложение на основе Symfony v6. Теперь я хочу обновить Symfony до ^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.*"
}
}
}
Действительно ли это работало в более ранней версии Symfony 6.x? Пакет пользователей FOS вызывает у меня большие подозрения. Вы можете попробовать предложения в ответе. Возможно, будет проще просто создать новое приложение Symfony, а затем добавить различные сторонние пакеты. Затем переместите новый композитор.json в свое приложение. Но опять же, некоторые из ваших зависимостей кажутся устаревшими.
Похоже, вы используете код версии 2.46, что заставляет меня думать, что это программное обеспечение, которое находится в разработке. Это программное обеспечение для вашей компании или какое-то программное обеспечение, которое вы используете? Если версия действительно 2.46, а не какое-то произвольное число, то то, что говорит Серад, вероятно, опрометчиво. Однако, если это на самом деле не производственное программное обеспечение, то я бы согласился и начал все сначала! Если это код, который вы приобрели/используете где-то еще, обратитесь к поставщику или в службу поддержки. Производственный код уже версии 2.46, вероятно, не так-то просто обновить.
composer require symfony/symfony:^6.3
Поскольку composer.json
содержит все зависимости (это хорошая практика), но не symfony/symfony
, эта команда не работает, потому что symfony/symfony
заменит все зависимости.
Вместо этого мы можем:
symfony/dotenv
до 6.3 (вы использовали 5.3
)symfony/runtime
до 6.3 (вы использовали 5.4
)symfony/deprecation-contracts
, symfony/flex
и т. д.composer install
работает со следующими зависимостями:
{
"name": "projet/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.3",
"symfony/cache": "6.3.*",
"symfony/config": "6.3.*",
"symfony/console": "6.3.*",
"symfony/dependency-injection": "^6.3",
"symfony/deprecation-contracts": "^2.5",
"symfony/dotenv": "^6.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.3.*"
},
"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.3.*"
}
}
}
Чтобы выполнить минорное обновление версии (с 6.2 до 6.3), требуется нечто большее, чем просто composer require symfony/symfomy:~6.3
Подробный процесс можно просмотреть на официальном веб-сайте Symfony Framework: Обновление дополнительной версии.
В итоге:
composer update "symfony/*" --with-all-dependencies
Что касается ваших компонентов версии 5.4, вам необходимо выполнить Обновление основной версии. Это будет более активно.
Кроме того, забегая вперед, сейчас самое время, после того как вы выполнили все вышеперечисленное, начать работать над устареванием кода, потому что, когда выйдет следующая основная версия, вы будете на шаг впереди.
Покажите нам также свой json-файл композитора.