11.. index ::
22 single: Upgrading; Major Version
33
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)
55===============================================
66
77Every 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,
3030classes, etc) code still works, but is marked as *deprecated *, indicating that
3131it will be removed/changed in the future and that you should stop using it.
3232
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
3434functionality are removed. So, as long as you've updated your code to stop
3535using 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.
3737
3838To help you with this, deprecation notices are triggered whenever you end up
3939using a deprecated feature. When visiting your application in the
@@ -124,24 +124,41 @@ done!
124124-----------------------------------------------
125125
126126Once your code is deprecation free, you can update the Symfony library via
127- Composer by modifying your ``composer.json `` file:
127+ Composer by modifying your ``composer.json `` file. In this file update all
128+ mentions of ``4.4.* `` to ``5.0.* ``.
128129
129130.. code-block :: json
130131
131132 {
132133 "..." : " ..." ,
133134
134135 "require" : {
135- "symfony/symfony" : " ^4.1" ,
136+ "symfony/asset" : " 5.0.*" ,
137+ "symfony/flex" : " ^1.3.1" ,
138+ "symfony/mailer" : " 5.0.*" ,
139+ "symfony/yaml" : " 5.0.*"
136140 },
137141 "..." : " ..."
138142 }
139143
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+ }
156+
140157 Next, use Composer to download new versions of the libraries:
141158
142159.. code-block :: terminal
143160
144- $ composer update symfony/symfony
161+ $ composer update symfony/*
145162
146163 .. include :: /setup/_update_dep_errors.rst.inc
147164
@@ -156,10 +173,3 @@ The next major version *may* also contain new BC breaks as a BC layer is not alw
156173a possibility. Make sure you read the ``UPGRADE-X.0.md `` (where X is the new major
157174version) included in the Symfony repository for any BC break that you need to be aware
158175of.
159-
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