Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 402f5d4

Browse files
committed
Added a new articule about using/installing inestable Symfony versions
1 parent 9fb296d commit 402f5d4

File tree

5 files changed

+252
-0
lines changed

5 files changed

+252
-0
lines changed

cookbook/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The Cookbook
1818
event_dispatcher/index
1919
form/index
2020
frontend/index
21+
install/index
2122
logging/index
2223
profiler/index
2324
request/index

cookbook/install/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Install and Upgrade
2+
===================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
upgrading

cookbook/install/inestable_versions

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
How to Install and Use an Inestable Symfony Version
2+
===================================================
3+
4+
Symfony releases two new minor versions (2.5, 2.6, 2.7, etc.) per year, one in
5+
May and one in November (:doc:`see releases detail <contributing/community/releases>`).
6+
Testing the new Symfony versions in your projects as soon as possible is important
7+
to ensure that they will keep working as expected.
8+
9+
In this article you'll learn how to install and use new Symfony versions before
10+
they are released as stable versions.
11+
12+
Creating a New Project Based on an Inestable Symfony Version
13+
------------------------------------------------------------
14+
15+
Suppose that Symfony 2.7 version hasn't been released yet and you want to create
16+
a new project to test its features. First, :doc:`install Composer </cookbook/composer>`
17+
package manager. Then, open a command console, enter your projects directory and
18+
execute the following command:
19+
20+
.. code-block:: bash
21+
22+
$ composer create-project symfony/framework-standard-edition my_project "2.7.*" --stability=dev
23+
24+
Once the command finishes its execution, you'll have a new Symfony project created
25+
in the ``my_project/`` directory and based on the most recent code found in the
26+
``2.7`` branch.
27+
28+
If you want to test a beta version, use ``beta`` as the value of the ``stability``
29+
option:
30+
31+
.. code-block:: bash
32+
33+
$ composer create-project symfony/framework-standard-edition my_project "2.7.*" --stability=beta
34+
35+
Upgrading your Project to an Inestable Symfony Version
36+
------------------------------------------------------
37+
38+
Instead of creating a new empty project, in this section you'll update an existing
39+
Symfony application to an inestable framework version. Suppose again that Symfony
40+
2.7 version hasn't been released yet and you want to test it in your project.
41+
42+
First, open the ``composer.json`` file located in the root directory of your
43+
project. Then, edit the value of the version defined for the ``symfony/symfony``
44+
dependency:
45+
46+
.. code-block:: json
47+
48+
{
49+
"require": {
50+
// ...
51+
"symfony/symfony" : "2.7.*"
52+
}
53+
}
54+
55+
Then, before updating your dependencies, make sure that the project configuration
56+
allows to install inestable versions. If the ``composer.json`` file contains a
57+
``minimum-stability`` option, change its value to ``dev``. If that option doesn't
58+
exist, add it as follows:
59+
60+
.. code-block:: json
61+
62+
{
63+
"require": {
64+
// ...
65+
"symfony/symfony" : "2.7.*"
66+
},
67+
"minimum-stability": "dev"
68+
}
69+
70+
If you prefer to test a Symfony beta version, replace the ``dev`` value of the
71+
``minimum-stability`` option by ``beta``.
72+
73+
Then, open a command console, enter your project directory and execute the following command to update your project dependencies:
74+
75+
.. code-block:: bash
76+
77+
$ composer update
78+
79+
.. tip::
80+
81+
If you use Git to manage the project's code, it's a good practice to create
82+
a new branch to test the new Symfony version. This solution avoids introducing
83+
any issue in your application and allows you to test the new version with
84+
total confidence:
85+
86+
.. code-block:: bash
87+
88+
$ cd projects/my_project/
89+
$ git checkout -b testing_new_symfony
90+
// update composer.json configuration
91+
$ composer update
92+
93+
// ... after testing the new Symfony version
94+
$ git checkout master
95+
$ git branch -D testing_new_symfony

cookbook/install/upgrading.rst

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
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+
15+
Upgrading a Patch Version (e.g. 2.6.0 to 2.6.1)
16+
-----------------------------------------------
17+
18+
If you're upgrading and only the patch version (the last number) is changing,
19+
then it's *really* easy:
20+
21+
.. code-block:: bash
22+
23+
$ composer update symfony/symfony
24+
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 project, your ``composer.json`` included Symfony using a constraint
28+
like ``2.6.*``, where only the *last* version number will change when you
29+
update.
30+
31+
You may also want to upgrade the rest of your libraries. If you've done a
32+
good job with your `version constraints`_ in ``composer.json``, you can do
33+
this safely by running:
34+
35+
.. code-block:: bash
36+
37+
$ composer update
38+
39+
But beware. If you have some bad `version constraints`_ in your ``composer.json``,
40+
(e.g. ``dev-master``), then this could upgrade some non-Symfony libraries
41+
to new versions that contain backwards-compatibility breaking changes.
42+
43+
.. _upgrading-minor-version:
44+
45+
Upgrading a Minor Version (e.g. 2.5.3 to 2.6.1)
46+
-----------------------------------------------
47+
48+
If you're upgrading a minor version (where the middle number changes), then
49+
you should also *not* encounter significant backwards compatibility changes.
50+
For details, see our :doc:`/contributing/code/bc`.
51+
52+
However, some backwards-compatibility breaks *are* possible, and you'll learn
53+
in a second how to prepare for them.
54+
55+
There are two steps to upgrading:
56+
57+
:ref:`upgrade-minor-symfony-composer`;
58+
:ref:`upgrade-minor-symfony-code`
59+
60+
.. _`upgrade-minor-symfony-composer`:
61+
62+
1) Update the Symfony Library via Composer
63+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64+
65+
First, you need to update Symfony by modifying your ``composer.json`` file
66+
to use the new version:
67+
68+
.. code-block:: json
69+
70+
{
71+
"...": "...",
72+
73+
"require": {
74+
"php": ">=5.3.3",
75+
"symfony/symfony": "2.6.*",
76+
"...": "... no changes to anything else..."
77+
},
78+
"...": "...",
79+
}
80+
81+
Next, use Composer to download new versions of the libraries:
82+
83+
.. code-block:: bash
84+
85+
$ composer update symfony/symfony
86+
87+
You may also want to upgrade the rest of your libraries. If you've done a
88+
good job with your `version constraints`_ in ``composer.json``, you can do
89+
this safely by running:
90+
91+
.. code-block:: bash
92+
93+
$ composer update
94+
95+
But beware. If you have some bad `version constraints`_ in your ``composer.json``,
96+
(e.g. ``dev-master``), then this could upgrade some non-Symfony libraries
97+
to new versions that contain backwards-compatibility breaking changes.
98+
99+
.. _`upgrade-minor-symfony-code`:
100+
101+
2) Updating Your Code to Work with the new Version
102+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103+
104+
In theory, you should be done! However, you *may* need to make a few changes
105+
to your code to get everything working. Additionally, some features you're
106+
using might still work, but might now be deprecated. That's actually ok,
107+
but if you know about these deprecations, you can start to fix them over
108+
time.
109+
110+
Every version of Symfony comes with an UPGRADE file that describes these
111+
changes. Below are links to the file for each version, which you'll need
112+
to read to see if you need any code changes.
113+
114+
.. tip::
115+
116+
Don't see the version here that you're upgrading to? Just find the
117+
UPGRADE-X.X.md file for the appropriate version on the `Symfony Repository`_.
118+
119+
Upgrading to Symfony 2.6
120+
........................
121+
122+
First, of course, update your ``composer.json`` file with the ``2.6`` version
123+
of Symfony as described above in :ref:`upgrade-minor-symfony-composer`.
124+
125+
Next, check the `UPGRADE-2.6`_ document for details about any code changes
126+
that you might need to make in your project.
127+
128+
Upgrading to Symfony 2.5
129+
........................
130+
131+
First, of course, update your ``composer.json`` file with the ``2.5`` version
132+
of Symfony as described above in :ref:`upgrade-minor-symfony-composer`.
133+
134+
Next, check the `UPGRADE-2.5`_ document for details about any code changes
135+
that you might need to make in your project.
136+
137+
.. _`UPGRADE-2.5`: https://github.com/symfony/symfony/blob/2.5/UPGRADE-2.5.md
138+
.. _`UPGRADE-2.6`: https://github.com/symfony/symfony/blob/2.6/UPGRADE-2.6.md
139+
.. _`Symfony Repository`: https://github.com/symfony/symfony
140+
.. _`Composer Package Versions`: https://getcomposer.org/doc/01-basic-usage.md#package-versions
141+
.. _`version constraints`: https://getcomposer.org/doc/01-basic-usage.md#package-versions

cookbook/map.rst.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112

113113
* :doc:`/cookbook/frontend/bower`
114114

115+
* **Installing and Upgrading**
116+
117+
* :doc:`/cookbook/upgrading`
118+
* :doc:`/cookbook/inestable_version`
119+
115120
* :doc:`/cookbook/logging/index`
116121

117122
* :doc:`/cookbook/logging/monolog`
@@ -207,12 +212,15 @@
207212
* (email) :doc:`/cookbook/email/testing`
208213
* (form) :doc:`/cookbook/form/unit_testing`
209214

215+
<<<<<<< HEAD
210216
* :doc:`/cookbook/upgrade/index`
211217

212218
* :doc:`/cookbook/upgrade/patch_version`
213219
* :doc:`/cookbook/upgrade/minor_version`
214220
* :doc:`/cookbook/upgrade/major_version`
215221

222+
=======
223+
>>>>>>> Added a new articule about using/installing inestable Symfony versions
216224
* :doc:`/cookbook/validation/index`
217225

218226
* :doc:`/cookbook/validation/custom_constraint`

0 commit comments

Comments
 (0)