How to upgrade my Symfony applications while using flex?

1.2k views Asked by At

I found a Symfony component I would like to use in my project but it is only available since the version 5.2 and all my Symfony elements are currently in version 5.1.10.

I read the following links :

But I did not found how to upgrade all my current 5.1.10 version elements to 5.2.

I tried to manualy replace all '5.1.*' occurences in my composer.json with '5.2.*' and then run composer update but it did not work and throws the following error :

    Your requirements could not be resolved to an installable set of packages.
Problem 1
    - The requested package symfony/symfony 5.2.* exists as symfony/symfony[5.1.x-dev, v5.1.0, v5.1.0-BETA1, v5.1.0-RC1, v5.1.0-RC2, v5.1.1, v5.1.10, v5.1.2, v5.1.3, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these are rejected by your constraint.
  Problem 2
    - symfony/framework-bundle v5.2.1 requires symfony/cache ^5.2 -> no matching package found.
    - symfony/framework-bundle v5.2.0 requires symfony/cache ^5.2 -> no matching package found.
    - Installation request for symfony/framework-bundle 5.2.* -> satisfiable by symfony/framework-bundle[v5.2.0, v5.2.1].
1

There are 1 answers

0
stollr On

I you want to upgrade a minor version, e.g. from 5.1 to 5.2 you can follow this documentation

to upgrade to a new minor version, you will probably need to update the version constraint next to each library starting symfony/. Suppose you are upgrading from Symfony 4.3 to 4.4:

{
    "...": "...",

    "require": {
-         "symfony/cache": "4.3.*",
+         "symfony/cache": "4.4.*",
-         "symfony/config": "4.3.*",
+         "symfony/config": "4.4.*",
-         "symfony/console": "4.3.*",
+         "symfony/console": "4.4.*",
        "...": "...",

        "...": "A few libraries starting with
                symfony/ follow their versioning scheme. You
                do not need to update these versions: you can
                upgrade them independently whenever you want",
        "symfony/monolog-bundle": "^3.5",
    },
    "...": "...",
}

Your composer.json file should also have an extra block that you will also need to update:

"extra": {
    "symfony": {
        "...": "...",
-         "require": "4.3.*"
+         "require": "4.4.*"
    }
}

After that you can update your dependencies with:

composer update