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

Skip to content

Update docs now that sessions are enabled automatically #10510

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 1 commit into from
Oct 19, 2018
Merged
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
22 changes: 5 additions & 17 deletions controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -383,24 +383,12 @@ Managing the Session
--------------------

Symfony provides a session service that you can use to store information
about the user between requests. Session storage and other configuration can
be controlled under the :ref:`framework.session configuration <config-framework-session>`.
about the user between requests. Session is enabled by default, but will only be
started if you read or write from it.

First, activate the session by uncommenting the ``session`` key in ``config/packages/framework.yaml``:

.. code-block:: diff

# config/packages/framework.yaml
framework:
# ...

- #session:
- # # The native PHP session handler will be used
- # handler_id: ~
+ session:
+ # The native PHP session handler will be used
+ handler_id: ~
# ...
Session storage and other configuration can be controlled under the
:ref:`framework.session configuration <config-framework-session>` in
``config/packages/framework.yaml``.

To get the session, add an argument and type-hint it with
:class:`Symfony\\Component\\HttpFoundation\\Session\\SessionInterface`::
Expand Down