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,12 +30,14 @@ 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. That means that
37+ you should first :doc: `upgrade to the last minor version </setup/upgrade_minor >`
38+ (e.g. 4.4) so that you can see *all * the deprecations.
3739
38- To help you with this, deprecation notices are triggered whenever you end up
40+ To help you find deprecations, notices are triggered whenever you end up
3941using a deprecated feature. When visiting your application in the
4042:ref: `dev environment <configuration-environments >`
4143in your browser, these notices are shown in the web dev toolbar:
9698.. sidebar :: Using the Weak Deprecations Mode
9799
98100 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
101+ in 4 .4 and you still need to support 4 .3). In these cases, you can still
100102 use the bridge to fix as many deprecations as possible and then allow
101103 more of them to make your tests pass again. You can do this by using the
102104 ``SYMFONY_DEPRECATIONS_HELPER `` env variable:
@@ -124,24 +126,50 @@ done!
124126-----------------------------------------------
125127
126128Once your code is deprecation free, you can update the Symfony library via
127- Composer by modifying your ``composer.json `` file:
129+ Composer by modifying your ``composer.json `` file and changing all the libraries
130+ starting with ``symfony/ `` to the new major version:
128131
129- .. code-block :: json
132+ .. code-block :: diff
130133
131134 {
132135 "...": "...",
133136
134137 "require": {
135- "symfony/symfony" : " ^4.1" ,
138+ - "symfony/cache": "4.3.*",
139+ + "symfony/cache": "4.4.*",
140+ - "symfony/config": "4.3.*",
141+ + "symfony/config": "4.4.*",
142+ - "symfony/console": "4.3.*",
143+ + "symfony/console": "4.4.*",
144+ "...": "...",
145+
146+ "...": "A few libraries starting with
147+ symfony/ follow their versioning scheme. You
148+ do not need to update these versions: you can
149+ upgrade them independently whenever you want",
150+ "symfony/monolog-bundle": "^3.5",
136151 },
137- "..." : " ..."
152+ "...": "...",
153+ }
154+
155+ Your ``composer.json `` file should also have an ``extra `` block that you will
156+ *also * need to update:
157+
158+ .. code-block :: diff
159+
160+ "extra": {
161+ "symfony": {
162+ "...": "...",
163+ - "require": "4.4.*"
164+ + "require": "5.0.*"
165+ }
138166 }
139167
140168 Next, use Composer to download new versions of the libraries:
141169
142170.. code-block :: terminal
143171
144- $ composer update symfony/symfony
172+ $ composer update symfony/*
145173
146174 .. include :: /setup/_update_dep_errors.rst.inc
147175
@@ -152,14 +180,6 @@ Next, use Composer to download new versions of the libraries:
1521803) Update your Code to Work with the New Version
153181------------------------------------------------
154182
155- The next major version *may * also contain new BC breaks as a BC layer is not always
156- a possibility. Make sure you read the ``UPGRADE-X.0.md `` (where X is the new major
157- version) included in the Symfony repository for any BC break that you need to be aware
158- of.
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 `.
183+ In some rare situations, the next major version *may * contain backwards-compatibility
184+ breaks. Make sure you read the ``UPGRADE-X.0.md `` (where X is the new major version)
185+ included in the Symfony repository for any BC break that you need to be aware of.
0 commit comments