1
- How to Upgrade your Symfony Project
1
+ How to Upgrade Your Symfony Project
2
2
===================================
3
3
4
4
So a new Symfony release has come out and you want to upgrade, great! Fortunately,
5
5
because Symfony protects backwards-compatibility very closely, this *should *
6
6
be quite easy.
7
7
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
+
8
15
Upgrading a Patch Version (e.g. 2.6.0 to 2.6.1)
9
16
-----------------------------------------------
10
17
@@ -15,40 +22,44 @@ then it's *really* easy:
15
22
16
23
$ composer update symfony/symfony
17
24
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.
20
29
21
30
You may also want to upgrade the rest of your libraries. If you've done a
22
31
good job with your version constraints in ``composer.json ``, you can do this
23
32
safely by running:
24
33
25
34
.. code-block :: bash
26
35
27
- $ composer update symfony/symfony
36
+ $ composer update
28
37
29
38
But beware. If you have some bad version constraints in your ``composer.json ``,
30
39
(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 :
32
43
33
44
Upgrading a Minor Version (e.g. 2.5.3 to 2.6.0)
34
45
-----------------------------------------------
35
46
36
47
If 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.
38
49
For details, see our :doc: `/contributing/code/bc `.
39
50
40
- However, some backwards-compability breaks *are * possible, and you'll learn
51
+ However, some backwards-compatibility breaks *are * possible, and you'll learn
41
52
in a second how to prepare for them.
42
53
43
54
There are two steps to upgrading:
44
55
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.
47
58
48
59
.. _`upgrade-minor-symfony-composer` :
49
60
50
- Update the Symfony Library
51
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
61
+ Update the Symfony Library via Composer
62
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52
63
53
64
First, you need to update Symfony by modifying your ``composer.json `` to
54
65
use the new version:
@@ -60,13 +71,13 @@ use the new version:
60
71
61
72
"require" : {
62
73
"php" : " >=5.3.3" ,
63
- "symfony/symfony" : " ~2.6.0 " ,
74
+ "symfony/symfony" : " ~2.6.* " ,
64
75
"..." : " ... no changes to anything else..."
65
76
},
66
77
"..." : " ..." ,
67
78
}
68
79
69
- Next, update the same as before :
80
+ Next, use Composer to download new versions of the libraries :
70
81
71
82
.. code-block :: bash
72
83
@@ -75,12 +86,12 @@ Next, update the same as before:
75
86
Updating a minor version like this should *not * cause any dependency issues,
76
87
though it's always possible that an outside library or bundle you're using
77
88
didn'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
79
90
in ``composer.json `` and run a full ``composer update ``.
80
91
81
92
.. _`upgrade-minor-symfony-code` :
82
93
83
- Updating your Code to work with the new Version
94
+ Updating Your Code to Work with the new Version
84
95
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85
96
86
97
In 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
90
101
time.
91
102
92
103
Every 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 `_.
95
111
96
112
Upgrading to Symfony 2.6
97
113
........................
98
114
99
115
First, of course, update your ``composer.json `` file with the ``2.6 `` version
100
116
of Symfony as described above in :ref: `upgrade-minor-symfony-composer `.
101
117
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.
103
120
104
121
* If you're using PdoSessionStorage, there was a change in the session schema
105
122
that **requires ** your session table to be updated. See :doc: `/cookbook/configuration/pdo_session_storage `.
@@ -114,14 +131,9 @@ Upgrading to Symfony 2.5
114
131
First, of course, update your ``composer.json `` file with the ``2.5 `` version
115
132
of Symfony as described above in :ref: `upgrade-minor-symfony-composer `.
116
133
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.
123
136
124
137
.. _`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
126
138
.. _`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