Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sgupta1979's avatar

Symfony upgrade from 3.4 to 4.*

Hello

I am trying to upgrade my application from symfony 3.4 to 4.. Also current PHP version is 7.4. to 8.1.*

I am getting lots of conflicts while executing 'composer update' on GIT Bash.

Please guide me with proper step by step guidelines to get this done.

Below are list of conflicts I am facing

Problem 1 - Root composer.json requires jms/serializer-bundle ^2.4 -> satisfiable by jms/serializer-bundle[2.4.0, ..., 2.4.4]. - jms/serializer-bundle[2.4.0, ..., 2.4.4] require php ^5.4|^7.0 -> your php version (8.1.20) does not satisfy that requirement.

Problem 2 - Root composer.json requires knplabs/knp-menu-bundle ^2.3 -> satisfiable by knplabs/knp-menu-bundle[v2.3.0]. - knplabs/knp-menu-bundle v2.3.0 requires php ^7.1 -> your php version (8.1.20) does not satisfy that requirement.

Problem 3 - Root composer.json requires doctrine/doctrine-fixtures-bundle ^2.4 -> satisfiable by doctrine/doctrine-fixtures-bundle[v2.4.0, v2.4.1]. - doctrine/doctrine-fixtures-bundle[v2.4.0, ..., v2.4.1] require doctrine/doctrine-bundle ~1.0 -> found doctrine/doctrine-bundle[v1.0.0, ..., 1.12.13] but it conflicts with your root composer.json require (^2.4).

Problem 4 - symfony/symfony[v4.0.0, ..., v4.4.8] require php ^7.1.3 -> your php version (8.1.20) does not satisfy that requirement. - Only one of these can be installed: symfony/symfony[v4.0.0, ..., v4.4.50], symfony/dotenv[v3.4.0, ..., v3.4.47]. symfony/symfony replaces symfony/dotenv and thus cannot coexist with it. - Root composer.json requires symfony/dotenv ^3.4 -> satisfiable by symfony/dotenv[v3.4.0, ..., v3.4.47]. - Root composer.json requires symfony/symfony 4.* -> satisfiable by symfony/symfony[v4.0.0, ..., v4.4.50].

0 likes
1 reply
LaryAI's avatar
Level 58

To upgrade your Symfony application from version 3.4 to 4.*, you need to follow these steps:

Step 1: Update PHP Version Make sure your PHP version is compatible with Symfony 4.. In this case, you mentioned that your current PHP version is 7.4, which is compatible. However, you mentioned that you want to upgrade to PHP 8.1., so make sure your application is compatible with that version as well.

Step 2: Update Symfony Dependencies To update your Symfony dependencies, you need to modify your composer.json file. Here are the changes you need to make:

  1. Update the require section to require Symfony 4.*:
"require": {
    "symfony/symfony": "^4.0",
    // other dependencies
},
  1. Remove any conflicting dependencies that are not compatible with Symfony 4.. In this case, you have conflicts with jms/serializer-bundle, knplabs/knp-menu-bundle, doctrine/doctrine-fixtures-bundle, and symfony/dotenv. You can remove them from your composer.json file or update them to versions that are compatible with Symfony 4..

  2. Run composer update to update your dependencies:

composer update

Step 3: Resolve Conflicts When you run composer update, you may encounter conflicts between different dependencies. You need to resolve these conflicts by updating the conflicting dependencies or finding alternative packages that are compatible with Symfony 4.*.

In your case, you have conflicts with jms/serializer-bundle, knplabs/knp-menu-bundle, doctrine/doctrine-fixtures-bundle, and symfony/dotenv. You can try updating these packages to versions that are compatible with Symfony 4.*. If there are no compatible versions available, you may need to find alternative packages or remove them if they are not essential for your application.

Step 4: Test and Fix Issues After updating your dependencies and resolving conflicts, you need to thoroughly test your application to ensure everything is working as expected. Check for any deprecations or breaking changes introduced in Symfony 4.* and update your code accordingly.

It's also a good idea to consult the Symfony upgrade guide for more detailed instructions on upgrading from Symfony 3.4 to 4.*.

Remember to backup your application before making any changes and consider using version control (e.g., Git) to track your changes during the upgrade process.

Please or to participate in this conversation.