Following by the official guide You need to do those steps to upgrade Symfony:
- Make your Code Deprecation Free
- Update to the New Major Version via Composer
- Update recipes
- Update your Code to Work with the New Version
Personally I will add additional steps to this list.
- Upgrade Docker image
- Update deployment scenario
- 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:
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
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) [Composer\Downloader\TransportException] 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
$ composer install