phpsymfonycomposer-phpsymfony-flex

How to update symfony with flex?


I think my question may be stupid, but I can’t figure out how to upgrade my Symfony project from version 4.1. * to version 4.3. *.

I tried to touch the composer.json. But it sends me an error message... Does anyone have the solution?

composer.json

I had this :

"conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.1.*"
        }
    }

I changed by that:

"conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.3.*"
        }
    }

Version 4.4 does not download or update...


Solution

  • extra.symfony.require is for performance reasons, as symfony has too many versions and update may take a long time. To update project you also need to add 4.3.* constraint to the require section:

    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/console": "4.3.*",
        "symfony/dotenv": "4.3.*",
        "symfony/flex": "^1.1",
        "symfony/framework-bundle": "4.3.*",
        "symfony/yaml": "4.3.*"
    },