1- How to Upgrade your Symfony Project
1+ How to Upgrade Your Symfony Project
22===================================
33
44So a new Symfony release has come out and you want to upgrade, great! Fortunately,
55because Symfony protects backwards-compatibility very closely, this *should *
66be quite easy.
77
8+ There are two types of upgrades, and both are a little different:
9+
10+ * :ref: `upgrading-patch-version `
11+ * :ref: `upgrading-minor-version `
12+
13+ .. _upgrading-patch-version :
14+
815Upgrading a Patch Version (e.g. 2.6.0 to 2.6.1)
916-----------------------------------------------
1017
@@ -15,40 +22,44 @@ then it's *really* easy:
1522
1623 $ composer update symfony/symfony
1724
18- That's it! You should not encounter any backwards-compatability breaks or
19- need to change anything else in your code.
25+ That's it! You should not encounter any backwards-compatibility breaks or
26+ need to change anything else in your code. That's because when you started
27+ your Symfony project, your ``composer.json `` included Symfony using a constraint
28+ such as ``2.6.* ``, where only the *last * version number changes when you update.
2029
2130You may also want to upgrade the rest of your libraries. If you've done a
2231good job with your version constraints in ``composer.json ``, you can do this
2332safely by running:
2433
2534.. code-block :: bash
2635
27- $ composer update symfony/symfony
36+ $ composer update
2837
2938 But beware. If you have some bad version constraints in your ``composer.json ``,
3039(e.g. ``dev-master ``), then this could upgrade some non-Symfony libraries
31- to new versions that contain backwards-compability changes.
40+ to new versions that contain backwards-compatibility breaking changes.
41+
42+ .. _upgrading-minor-version :
3243
3344Upgrading a Minor Version (e.g. 2.5.3 to 2.6.0)
3445-----------------------------------------------
3546
3647If you're upgrading a minor version (where the middle number changes), then
37- you should also *not * encounter significant backwards compability changes.
48+ you should also *not * encounter significant backwards compatibility changes.
3849For details, see our :doc: `/contributing/code/bc `.
3950
40- However, some backwards-compability breaks *are * possible, and you'll learn
51+ However, some backwards-compatibility breaks *are * possible, and you'll learn
4152in a second how to prepare for them.
4253
4354There are two steps to upgrading:
4455
45- 1 . :ref: `upgrade-minor-symfony-composer `;
46- 2 . :ref: `upgrade-minor-symfony-code `, which includes instructions for each version.
56+ # . :ref: `upgrade-minor-symfony-composer `;
57+ # . :ref: `upgrade-minor-symfony-code `, which includes instructions for each version.
4758
4859.. _`upgrade-minor-symfony-composer` :
4960
50- Update the Symfony Library
51- ~~~~~~~~~~~~~~~~~~~~~~~~~~
61+ Update the Symfony Library via Composer
62+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5263
5364First, you need to update Symfony by modifying your ``composer.json `` to
5465use the new version:
@@ -60,13 +71,13 @@ use the new version:
6071
6172 "require" : {
6273 "php" : " >=5.3.3" ,
63- "symfony/symfony" : " ~2.6.0 " ,
74+ "symfony/symfony" : " ~2.6.* " ,
6475 "..." : " ... no changes to anything else..."
6576 },
6677 "..." : " ..." ,
6778 }
6879
69- Next, update the same as before :
80+ Next, use Composer to download new versions of the libraries :
7081
7182.. code-block :: bash
7283
@@ -75,12 +86,12 @@ Next, update the same as before:
7586 Updating a minor version like this should *not * cause any dependency issues,
7687though it's always possible that an outside library or bundle you're using
7788didn't support this new version of Symfony at the version you have of that
78- library. In that case, consult the library: you may need to modify its version
89+ library. In that case, consult the library: you may need to modify its version
7990in ``composer.json `` and run a full ``composer update ``.
8091
8192.. _`upgrade-minor-symfony-code` :
8293
83- Updating your Code to work with the new Version
94+ Updating Your Code to Work with the new Version
8495~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8596
8697In theory, you should be done! However, you *may * need to make a few changes
@@ -90,16 +101,22 @@ but if you know about these deprecations, you can start to fix them over
90101time.
91102
92103Every version of Symfony comes with an UPGRADE file that describes these
93- changes. Below are links to the file for each version, along with some other
94- details.
104+ changes. Below are links to the file for each version, which you'll need
105+ to read to see if you need any code changes.
106+
107+ .. tip ::
108+
109+ Don't see the version here that you're upgrading too? Just find the
110+ UPGRADE-X.X.md file for the appropriate version on the `Symfony Repository `_.
95111
96112Upgrading to Symfony 2.6
97113........................
98114
99115First, of course, update your ``composer.json `` file with the ``2.6 `` version
100116of Symfony as described above in :ref: `upgrade-minor-symfony-composer `.
101117
102- Check the `UPGRADE-2.6 `_ document for details. Highlights:
118+ Next, check the `UPGRADE-2.6 `_ document for details about any code changes
119+ that you might need to make in your project.
103120
104121* If you're using PdoSessionStorage, there was a change in the session schema
105122 that **requires ** your session table to be updated. See :doc: `/cookbook/configuration/pdo_session_storage `.
@@ -114,14 +131,9 @@ Upgrading to Symfony 2.5
114131First, of course, update your ``composer.json `` file with the ``2.5 `` version
115132of Symfony as described above in :ref: `upgrade-minor-symfony-composer `.
116133
117- Check the `UPGRADE-2.5 `_ document for details. Highlights:
118-
119- * This version introduced a new Validator API. But, as long as you're using
120- PHP 5.3.9 or higher, you can configure Symfony in a way that allows you
121- to use the new API, but still let the old API work (called ``2.5-bc ``).
122- See the `UPGRADE-2.5-Validator `_ for details.
134+ Next, check the `UPGRADE-2.5 `_ document for details about any code changes
135+ that you might need to make in your project.
123136
124137.. _`UPGRADE-2.5` : https://github.com/symfony/symfony/blob/2.5/UPGRADE-2.5.md
125- .. _`UPGRADE-2.5-Validator` : https://github.com/symfony/symfony/blob/2.7/UPGRADE-2.5.md#validator
126138.. _`UPGRADE-2.6` : https://github.com/symfony/symfony/blob/2.6/UPGRADE-2.6.md
127- .. _`UPGRADE-2.6-DebugBundle ` : https://github.com/symfony/symfony/blob/2.6/UPGRADE-2.6.md#vardumper-and-debugbundle
139+ .. _`Symfony Repository ` : https://github.com/symfony/symfony
0 commit comments