|
| 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 |
0 commit comments