-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding details about recipe upgrade system and upgrade improvements #12959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,37 +22,43 @@ There are two steps to upgrading a minor version: | |
------------------------------------------ | ||
|
||
The ``composer.json`` file is configured to allow Symfony packages to be | ||
upgraded to patch versions. But, if you would like the packages to be upgraded | ||
to minor versions, check that the version constrains of the Symfony dependencies | ||
are like this: | ||
upgraded to patch versions. But to upgrade to a new minor version, you will | ||
probably need to update the version constraint next to each library starting | ||
``symfony/``. Suppose you are upgrading from Symfony 4.3 to 4.4: | ||
|
||
.. code-block:: json | ||
.. code-block:: diff | ||
|
||
{ | ||
"...": "...", | ||
|
||
"require": { | ||
"symfony/cache": "^4.0", | ||
"symfony/config": "^4.0", | ||
"symfony/console": "^4.0", | ||
"symfony/debug": "^4.0", | ||
"symfony/dependency-injection": "^4.0", | ||
"symfony/dotenv": "^4.0", | ||
"...": "..." | ||
- "symfony/cache": "4.3.*", | ||
+ "symfony/cache": "4.4.*", | ||
- "symfony/config": "4.3.*", | ||
+ "symfony/config": "4.4.*", | ||
- "symfony/console": "4.3.*", | ||
+ "symfony/console": "4.4.*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure this is the case? (I'm on Windows atm, so I cannot test it) If I'm reading https://github.com/symfony/skeleton/blob/master/composer.json correctly, the dependencies are actually marked as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes ... that's how I've seen it in modern Symfony apps ... but the reader of this document can use any method actually, especially if they are upgrading from very old Symfony versions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In practice, when you I talked with Nicolas about this, and I think it (the usage the |
||
"...": "...", | ||
|
||
"...": "A few libraries starting with | ||
symfony/ follow their versioning scheme. You | ||
do not need to update these versions: you can | ||
upgrade them independently whenever you want", | ||
"symfony/monolog-bundle": "^3.5", | ||
}, | ||
"...": "...", | ||
} | ||
|
||
At the bottom of your ``composer.json`` file, in the ``extra`` block you can | ||
find a data setting for the symfony version. Make sure to also upgrade | ||
this one. For instance, update it to ``4.3.*`` to upgrade to Symfony 4.3: | ||
Your ``composer.json`` file should also have an ``extra`` block that you will | ||
*also* need to update: | ||
|
||
.. code-block:: json | ||
.. code-block:: diff | ||
|
||
"extra": { | ||
"symfony": { | ||
"allow-contrib": false, | ||
"require": "4.3.*" | ||
"...": "...", | ||
- "require": "4.3.*" | ||
+ "require": "4.4.*" | ||
} | ||
} | ||
|
||
|
@@ -76,12 +82,52 @@ to your code to get everything working. Additionally, some features you're | |
using might still work, but might now be deprecated. While that's just fine, | ||
if you know about these deprecations, you can start to fix them over time. | ||
|
||
Every version of Symfony comes with an UPGRADE file (e.g. `UPGRADE-4.1.md`_) | ||
Every version of Symfony comes with an UPGRADE file (e.g. `UPGRADE-4.4.md`_) | ||
included in the Symfony directory that describes these changes. If you follow | ||
the instructions in the document and update your code accordingly, it should be | ||
safe to update in the future. | ||
|
||
These documents can also be found in the `Symfony Repository`_. | ||
|
||
.. _updating-flex-recipes: | ||
|
||
3) Updating Recipes | ||
------------------- | ||
|
||
Over time - and especially when you upgrade to a new version of a library - an | ||
updated version of the :ref:`recipe <recipes-description>` may be available. | ||
These updates are usually minor - e.g. new comments in a configuration file - but | ||
it's a good idea to update the core Symfony recipes. | ||
|
||
Symfony Flex provides several commands to help upgrade your recipes. Be sure to | ||
commit any unrelated changes you're working on before starting: | ||
|
||
.. versionadded:: 1.6 | ||
|
||
The recipes commands were introduced in Symfony Flex 1.6. | ||
|
||
.. code-block:: terminal | ||
|
||
# see a list of all installed recipes and which have updates available | ||
$ composer recipes | ||
|
||
# see detailed information about a specific recipes | ||
$ composer recipes symfony/framework-bundle | ||
|
||
# update a specific recipes | ||
$ composer recipes:install symfony/framework-bundle --force -v | ||
|
||
The tricky part of this process is that the recipe "update" does not perform | ||
any intelligent "upgrading" of your code. Instead, **the updates process re-installs | ||
the latest version of the recipe** which means that **your custom code will be | ||
overridden completely**. After updating a recipe, you need to carefully choose | ||
which changes you want, and undo the rest. | ||
weaverryan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. admonition:: Screencast | ||
:class: screencast | ||
|
||
For a detailed example, see the `SymfonyCasts Symfony 5 Upgrade Tutorial`_. | ||
|
||
.. _`Symfony Repository`: https://github.com/symfony/symfony | ||
.. _`UPGRADE-4.1.md`: https://github.com/symfony/symfony/blob/4.1/UPGRADE-4.1.md | ||
.. _`UPGRADE-4.4.md`: https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.4.md | ||
.. _`SymfonyCasts Symfony 5 Upgrade Tutorial`: https://symfonycasts.com/screencast/symfony5-upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time flies!