如何升级 symfony 次要版本(4.1 到 4.2) [英] How to upgrade symfony minor version (4.1 to 4.2)
问题描述
我只想知道升级 symfony 小版本的正确方法是什么.
在文档https://symfony.com/doc/current/setup/upgrade_minor.html 它说只是为了升级 composer 中的 symfony/symfony 包,但我没有这个包,而是我有各种 symfony/framework-bundle、symfony/form 等.
到目前为止我所做的是将所有 symfony/XXX 升级到新版本.
我还必须在其他文件夹中创建一个 4.2 版本的新项目,并复制文件 .gitignore
、public/index.php
、config/bootstrap.php
和 src/kernel.php
到原始项目,因为这些文件已从 4.1 更改为 4.2,但我认为这不应该是这样做的方式.>
我是否应该删除所有 symfony/XX 软件包并用 symfony/symfony 替换它们?
这次会升级文件 public/index.php
、config/bootstra.php
等吗?
谢谢
就我而言,我从 4.1.11 更新到 4.2,但由于某些原因,4.2 中的一些新文件没有自动创建.此外,我认为环境文件中的一些更改非常重要.
我认为最好和最干净的方法是执行以下操作:
说明
- 更新
composer.json
额外":{symfony":{允许贡献":假,要求":4.2.*"}}
删除
###>symfony/框架包###/.env
添加
###>symfony/框架包###/.env.local/.env.local.php/.env.*.local
- 重命名
.env
为.env.local
- 重命名
.env.dist
为.env
-- 2019 年 5 月 30 日更新 --
- 使用 此代码
<小时>
使用 PHPUnit 进行测试
如果您在应用程序中使用 PHPUnit,请遵循以下额外步骤(推荐):
- 创建一个新的
.env.test
并为测试环境设置变量. - 使用 此代码.
<小时>
重要
您应该将环境文件更改通知您的团队,他们应该在拉取更改之前备份其当前配置,因为它会覆盖 .env
文件.
如果您需要有关此解决方案的更多信息,请阅读:https://symfony.com/doc/current/configuration/dot-env-changes.html
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
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.php
file with this code. - Update
public/index.php
file with this code. - Update
.gitignore
Remove
###> symfony/framework-bundle ###
/.env
Add
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
- Rename
.env
to.env.local
- Rename
.env.dist
to.env
-- Update 30/05/19 --
- Update
bin/console
file with this code
Testing with PHPUnit
Follow this extra steps if you are using PHPUnit in your application (Recommended):
- Create a new
.env.test
and set your variables for test environment. - Update
phpunit.xml.dist
with 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
这篇关于如何升级 symfony 次要版本(4.1 到 4.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!