Upgrade Symfony 5.4 to 6.0

Following by the official guide You need to do those steps to upgrade Symfony:

  1. Make your Code Deprecation Free
  2. Update to the New Major Version via Composer
  3. Update recipes
  4. Update your Code to Work with the New Version

Personally I will add additional steps to this list.

  1. Upgrade Docker image
  2. Update deployment scenario
  3. Update crontab entries

Update Docker image version

I am using Docksal, so upgrading to PHP 8.1 is simply change the version in .docksal/docksal.env file:


and run fin start command.

Find out more about Docksal on official page or on my slides.

Update deployment scenario

Old project might use different composer version and/or different PHP version. In my case I need to download new composer and change command from: php80 ~/bin/composer.phar install to php81 ~/bin/composer2.phar install

Update crontab entries

Here the change is similar like in deployment scenario. Simply had to change php80 to php81.

What if any problems?

On my local computer everything was working with no problem. But when I run composer install on server, it throws an error:

$ composer install -n
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
The following exception probably indicates you have misconfigured DNS resolver(s)
curl error 6 while downloading https://flex.symfony.com/versions.json: Could not resolve host: flex.symfony.com                                                                        

It seems, that the problem is caused during connection to flex.symfony.com domain. I find out (see at stackoverflow and Symfony), that is due to old symfony/flex library.

To fix this problem I had to run:

$ composer update symfony/flex --no-plugins --no-scripts

and then

$ composer install