Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f86b9c9

Browse filesBrowse files
committed
Adding a guide about upgrading
1 parent 01df3e7 commit f86b9c9
Copy full SHA for f86b9c9

File tree

Expand file treeCollapse file tree

1 file changed

+127
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+127
-0
lines changed

‎cookbook/upgrading.rst

Copy file name to clipboard
+127Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
How to Upgrade your Symfony Project
2+
===================================
3+
4+
So a new Symfony release has come out and you want to upgrade, great! Fortunately,
5+
because Symfony protects backwards-compatibility very closely, this *should*
6+
be quite easy.
7+
8+
Upgrading a Patch Version (e.g. 2.6.0 to 2.6.1)
9+
-----------------------------------------------
10+
11+
If you're upgrading and only the patch version (the last number) is changing,
12+
then it's *really* easy:
13+
14+
.. code-block:: bash
15+
16+
$ composer update symfony/symfony
17+
18+
That's it! You should not encounter any backwards-compatability breaks or
19+
need to change anything else in your code.
20+
21+
You may also want to upgrade the rest of your libraries. If you've done a
22+
good job with your version constraints in ``composer.json``, you can do this
23+
safely by running:
24+
25+
.. code-block:: bash
26+
27+
$ composer update symfony/symfony
28+
29+
But beware. If you have some bad version constraints in your ``composer.json``,
30+
(e.g. ``dev-master``), then this could upgrade some non-Symfony libraries
31+
to new versions that contain backwards-compability changes.
32+
33+
Upgrading a Minor Version (e.g. 2.5.3 to 2.6.0)
34+
-----------------------------------------------
35+
36+
If you're upgrading a minor version (where the middle number changes), then
37+
you should also *not* encounter significant backwards compability changes.
38+
For details, see our :doc:`/contributing/code/bc`.
39+
40+
However, some backwards-compability breaks *are* possible, and you'll learn
41+
in a second how to prepare for them.
42+
43+
There are two steps to upgrading:
44+
45+
1. :ref:`upgrade-minor-symfony-composer`;
46+
2. :ref:`upgrade-minor-symfony-code`, which includes instructions for each version.
47+
48+
.. _`upgrade-minor-symfony-composer`:
49+
50+
Update the Symfony Library
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
53+
First, you need to update Symfony by modifying your ``composer.json`` to
54+
use the new version:
55+
56+
.. code-block:: json
57+
58+
{
59+
"...": "...",
60+
61+
"require": {
62+
"php": ">=5.3.3",
63+
"symfony/symfony": "~2.6.0",
64+
"...": "... no changes to anything else..."
65+
},
66+
"...": "...",
67+
}
68+
69+
Next, update the same as before:
70+
71+
.. code-block:: bash
72+
73+
$ composer update symfony/symfony
74+
75+
Updating a minor version like this should *not* cause any dependency issues,
76+
though it's always possible that an outside library or bundle you're using
77+
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
79+
in ``composer.json`` and run a full ``composer update``.
80+
81+
.. _`upgrade-minor-symfony-code`:
82+
83+
Updating your Code to work with the new Version
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85+
86+
In theory, you should be done! However, you *may* need to make a few changes
87+
to your code to get everything working. Additionally, some features you're
88+
using might still work, but might now be deprecated. That's actually ok,
89+
but if you know about these deprecations, you can start to fix them over
90+
time.
91+
92+
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.
95+
96+
Upgrading to Symfony 2.6
97+
........................
98+
99+
First, of course, update your ``composer.json`` file with the ``2.6`` version
100+
of Symfony as described above in :ref:`upgrade-minor-symfony-composer`.
101+
102+
Check the `UPGRADE-2.6`_ document for details. Highlights:
103+
104+
* If you're using PdoSessionStorage, there was a change in the session schema
105+
that **requires** your session table to be updated. See :doc:`/cookbook/configuration/pdo_session_storage`.
106+
107+
* Symfony 2.6 comes with a great new `dump`_ function. To use it, you'll
108+
need to add the new ``DebugBundle`` to your ``AppKernel``. See
109+
`UPGRADE-2.6-DebugBundle`_ for details.
110+
111+
Upgrading to Symfony 2.5
112+
........................
113+
114+
First, of course, update your ``composer.json`` file with the ``2.5`` version
115+
of Symfony as described above in :ref:`upgrade-minor-symfony-composer`.
116+
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.
123+
124+
.. _`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+
.. _`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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.