Skip to content

Update "upgrading" guide for Symfony5 #12673

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

Merged
merged 3 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ The Redis transport uses `streams`_ to queue messages.

The ``dbindex`` query parameter in Redis DSN was introduced in Symfony 4.4.

To use the Redis transport, you will need the Redis PHP extension (^4.3) and
To use the Redis transport, you will need the Redis PHP extension (>=4.3) and
a running Redis server (^5.0).

A number of options can be configured via the DSN or via the ``options`` key
Expand Down Expand Up @@ -1088,7 +1088,7 @@ Possible options to configure with tags are:
* ``priority``

.. versionadded:: 4.4

The ability to specify ``from_transport`` on the tag, was added in Symfony 4.4.

Handler Subscriber & Options
Expand Down
39 changes: 25 additions & 14 deletions setup/upgrade_major.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. index::
single: Upgrading; Major Version

Upgrading a Major Version (e.g. 3.4.0 to 4.1.0)
Upgrading a Major Version (e.g. 4.4.0 to 5.0.0)
===============================================

Every two years, Symfony releases a new major version release (the first number
Expand Down Expand Up @@ -30,10 +30,10 @@ backwards incompatible changes. To accomplish this, the "old" (e.g. functions,
classes, etc) code still works, but is marked as *deprecated*, indicating that
it will be removed/changed in the future and that you should stop using it.

When the major version is released (e.g. 4.1.0), all deprecated features and
When the major version is released (e.g. 5.0.0), all deprecated features and
functionality are removed. So, as long as you've updated your code to stop
using these deprecated features in the last version before the major (e.g.
3.4.*), you should be able to upgrade without a problem.
4.4.*), you should be able to upgrade without a problem.

To help you with this, deprecation notices are triggered whenever you end up
using a deprecated feature. When visiting your application in the
Expand Down Expand Up @@ -82,7 +82,7 @@ Now, you can start fixing the notices:
OK (10 tests, 20 assertions)

Remaining deprecation notices (6)

The "request" service is deprecated and will be removed in 3.0. Add a type-hint for
Symfony\Component\HttpFoundation\Request to your controller parameters to retrieve the
request instead: 6x
Expand All @@ -96,7 +96,7 @@ done!
.. sidebar:: Using the Weak Deprecations Mode

Sometimes, you can't fix all deprecations (e.g. something was deprecated
in 3.4 and you still need to support 3.3). In these cases, you can still
in 4.4 and you still need to support 4.3). In these cases, you can still
use the bridge to fix as many deprecations as possible and then allow
more of them to make your tests pass again. You can do this by using the
``SYMFONY_DEPRECATIONS_HELPER`` env variable:
Expand All @@ -123,7 +123,7 @@ done!
2) Update to the New Major Version via Composer
-----------------------------------------------

Once your code is deprecation free, you can update the Symfony library via
Once your code is deprecation free, you can update all the Symfony packages via
Composer by modifying your ``composer.json`` file:

.. code-block:: json
Expand All @@ -132,16 +132,33 @@ Composer by modifying your ``composer.json`` file:
"...": "...",

"require": {
"symfony/symfony": "^4.1",
"symfony/console": "^5.0",
"symfony/dotenv": "^5.0",
"symfony/framework-bundle": "^5.0",
"symfony/validator": "^5.0",
"symfony/yaml": "^5.0"
},
"...": "..."
}

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 ``5.0.*`` to upgrade to Symfony 5.0:

.. code-block:: json

"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.0.*"
}
}

Next, use Composer to download new versions of the libraries:

.. code-block:: terminal

$ composer update symfony/symfony
$ composer update "symfony/*"

.. include:: /setup/_update_dep_errors.rst.inc

Expand All @@ -157,9 +174,3 @@ a possibility. Make sure you read the ``UPGRADE-X.0.md`` (where X is the new maj
version) included in the Symfony repository for any BC break that you need to be aware
of.

4) Updating to the Symfony 4 Flex Directory Structure
-----------------------------------------------------

When upgrading to Symfony 4, you will probably also want to upgrade to the new
Symfony 4 directory structure so that you can take advantage of Symfony Flex.
This takes some work, but is optional. For details, see :doc:`/setup/flex`.