问题
I just want to know which is the proper way to upgrade symfony a minor version.
In the documentation https://symfony.com/doc/current/setup/upgrade_minor.html it says just to upgrade symfony/symfony package in composer, but I don't have this package, instead I have various symfony/framework-bundle, symfony/form, etc.
What I've done so far is to upgrade all symfony/XXX to the new version.
Also I had to create a new project with the 4.2 version in other folder, and copy the files .gitignore, public/index.php, config/bootstrap.php and src/kernel.php to the original project as these files has changed from 4.1 to 4.2, but I think this should not be the way to do it.
Should I have to remove all symfony/XX packages and replace them with symfony/symfony?
Will this upgrade also the files public/index.php, config/bootstra.php, etc?
Thank you
回答1:
In my case I was updating to 4.2 from 4.1.11 and some new files from 4.2 for some reason weren't automatically created. Also, there are a few changes in environment files that I consider very important.
I think the best and cleanest way to do this to do the following:
Instructions
- Update
composer.json
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
- Update dependencies
composer update "symfony/*" - Create a new
config/bootstrap.phpfile with this code. - Update
public/index.phpfile with this code. - Update
.gitignore
Remove
###> symfony/framework-bundle ###
/.env
Add
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
- Rename
.envto.env.local - Rename
.env.distto.env
-- Update 30/05/19 --
- Update
bin/consolefile with this code
Testing with PHPUnit
Follow this extra steps if you are using PHPUnit in your application (Recommended):
- Create a new
.env.testand set your variables for test environment. - Update
phpunit.xml.distwith this code.
Important
You should notify about the environment files changes to your team and they should make a backup of their current configuration before pulling the changes because it will override the .env file.
If you need more information about this solution please read: https://symfony.com/doc/current/configuration/dot-env-changes.html
回答2:
Just check your composer.json. I just did same and only had to raise the minor. Then I’ve ran composer update and I succeeded.
I always follow the guides.
https://symfony.com/doc/current/setup/upgrade_minor.html https://github.com/symfony/symfony/blob/4.2/UPGRADE-4.2.md
来源:https://stackoverflow.com/questions/54241640/how-to-upgrade-symfony-minor-version-4-1-to-4-2