1
1
.. index ::
2
2
single: Upgrading; Major Version
3
3
4
- Upgrading a Major Version (e.g. 3 .4.0 to 4.1 .0)
4
+ Upgrading a Major Version (e.g. 4 .4.0 to 5.0 .0)
5
5
===============================================
6
6
7
7
Every two years, Symfony releases a new major version release (the first number
@@ -30,10 +30,10 @@ backwards incompatible changes. To accomplish this, the "old" (e.g. functions,
30
30
classes, etc) code still works, but is marked as *deprecated *, indicating that
31
31
it will be removed/changed in the future and that you should stop using it.
32
32
33
- When the major version is released (e.g. 4.1 .0), all deprecated features and
33
+ When the major version is released (e.g. 5.0 .0), all deprecated features and
34
34
functionality are removed. So, as long as you've updated your code to stop
35
35
using these deprecated features in the last version before the major (e.g.
36
- 3 .4.*), you should be able to upgrade without a problem.
36
+ 4 .4.*), you should be able to upgrade without a problem.
37
37
38
38
To help you with this, deprecation notices are triggered whenever you end up
39
39
using a deprecated feature. When visiting your application in the
@@ -82,7 +82,7 @@ Now, you can start fixing the notices:
82
82
OK (10 tests, 20 assertions)
83
83
84
84
Remaining deprecation notices (6)
85
-
85
+
86
86
The "request" service is deprecated and will be removed in 3.0. Add a type-hint for
87
87
Symfony\Component\HttpFoundation\Request to your controller parameters to retrieve the
88
88
request instead: 6x
96
96
.. sidebar :: Using the Weak Deprecations Mode
97
97
98
98
Sometimes, you can't fix all deprecations (e.g. something was deprecated
99
- in 3 .4 and you still need to support 3 .3). In these cases, you can still
99
+ in 4 .4 and you still need to support 4 .3). In these cases, you can still
100
100
use the bridge to fix as many deprecations as possible and then allow
101
101
more of them to make your tests pass again. You can do this by using the
102
102
``SYMFONY_DEPRECATIONS_HELPER `` env variable:
@@ -123,7 +123,7 @@ done!
123
123
2) Update to the New Major Version via Composer
124
124
-----------------------------------------------
125
125
126
- Once your code is deprecation free, you can update the Symfony library via
126
+ Once your code is deprecation free, you can update all the Symfony packages via
127
127
Composer by modifying your ``composer.json `` file:
128
128
129
129
.. code-block :: json
@@ -132,16 +132,33 @@ Composer by modifying your ``composer.json`` file:
132
132
"..." : " ..." ,
133
133
134
134
"require" : {
135
- "symfony/symfony" : " ^4.1" ,
135
+ "symfony/console" : " ^5.0" ,
136
+ "symfony/dotenv" : " ^5.0" ,
137
+ "symfony/framework-bundle" : " ^5.0" ,
138
+ "symfony/validator" : " ^5.0" ,
139
+ "symfony/yaml" : " ^5.0"
136
140
},
137
141
"..." : " ..."
138
142
}
143
+
144
+ At the bottom of your ``composer.json `` file, in the ``extra `` block you can
145
+ find a data setting for the symfony version. Make sure to also upgrade
146
+ this one. For instance, update it to ``5.0.* `` to upgrade to Symfony 5.0:
147
+
148
+ .. code-block :: json
149
+
150
+ "extra" : {
151
+ "symfony" : {
152
+ "allow-contrib" : false ,
153
+ "require" : " 5.0.*"
154
+ }
155
+ }
139
156
140
157
Next, use Composer to download new versions of the libraries:
141
158
142
159
.. code-block :: terminal
143
160
144
- $ composer update symfony/symfony
161
+ $ composer update " symfony/*"
145
162
146
163
.. include :: /setup/_update_dep_errors.rst.inc
147
164
@@ -157,9 +174,3 @@ a possibility. Make sure you read the ``UPGRADE-X.0.md`` (where X is the new maj
157
174
version) included in the Symfony repository for any BC break that you need to be aware
158
175
of.
159
176
160
- 4) Updating to the Symfony 4 Flex Directory Structure
161
- -----------------------------------------------------
162
-
163
- When upgrading to Symfony 4, you will probably also want to upgrade to the new
164
- Symfony 4 directory structure so that you can take advantage of Symfony Flex.
165
- This takes some work, but is optional. For details, see :doc: `/setup/flex `.
0 commit comments