Categories
BEST PHP CODE Symfony Technical

Upgrading from 3.3.2 to Symfony 4.1

Use symfony profiler great help for upgrade

../_images/deprecations-in-profiler.png

Update to the New Major Version via Composer

Once your code is deprecation free, you can update the Symfony library via Composer by modifying your composer.json file:

1
2
3
4
5
6
7
8
{
    "...": "...",

    "require": {
        "symfony/symfony": "^4.1",
    },
    "...": "..."
}

Next, use Composer to download new versions of the libraries:

 composer update symfony/symfony

Dependency Errors

If you get a dependency error, it may simply mean that you need to upgrade other Symfony dependencies too. In that case, try the following command:

 composer update "symfony/*" --with-all-dependencies

This updates symfony/symfony and all packages that it depends on, which will include several other packages. By using tight version constraints in composer.json, you can control what versions each library upgrades to.