Skip to content

Commit 0e585b4

Browse files
committed
Completed "Allow to Install Symfony 3 Components" section
1 parent 4e93eb5 commit 0e585b4

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

cookbook/upgrade/bundles.rst

+29-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,35 @@ longer be able to use it.
1313
Allow to Install Symfony 3 Components
1414
-------------------------------------
1515

16-
.. TODO
17-
18-
* Change symfony/... ~2.N by ~2.N|~3.M
16+
Most third-party bundles define their Symfony dependencies using the ``~2.N`` or
17+
``^2.N`` constraints in the ``composer.json`` file. For example:
18+
19+
.. code-block:: json
20+
21+
{
22+
"require": {
23+
"symfony/framework-bundle": "~2.3",
24+
"symfony/finder": "~2.3",
25+
"symfony/validator": "~2.3",
26+
}
27+
}
28+
29+
These constraints prevent the bundle from using Symfony 3 components, so it makes
30+
it impossible to install it in a Symfony 3 based application. This issue is very
31+
easy to solve thanks to the flexibility of Composer dependencies constraints.
32+
Just replace ``~2.N`` by ``~2.N|~3.0`` (or ``^2.N`` by ``^2.N|~3.0``).
33+
34+
The above example can be updated to work with Symfony 3 as follows:
35+
36+
.. code-block:: json
37+
38+
{
39+
"require": {
40+
"symfony/framework-bundle": "~2.3|~3.0",
41+
"symfony/finder": "~2.3|~3.0",
42+
"symfony/validator": "~2.3|~3.0",
43+
}
44+
}
1945
2046
Look for Deprecations and Fix Them
2147
----------------------------------

0 commit comments

Comments
 (0)