diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index da817c5df39..c220ba2a78b 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -1364,10 +1364,45 @@ handler_id
**type**: ``string`` **default**: ``'session.handler.native_file'``
-The service id used for session storage. The default value ``'session.handler.native_file'``
+The service id or DSN used for session storage. The default value ``'session.handler.native_file'``
will let Symfony manage the sessions itself using files to store the session metadata.
-Set it to ``null`` to use the native PHP session mechanism.
-You can also :doc:`store sessions in a database `.
+Set it to ``null`` to use the native PHP session mechanism. You can also provide a DSN to specify
+the used storage-directory or :doc:`store sessions in a database `:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/framework.yaml
+ framework:
+ session:
+ # ...
+ handler_id: 'file://%kernel.project_dir%/var/sessions'
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->loadFromExtension('framework', [
+ 'session' => [
+ // ...
+ 'handler_id' => 'file://%kernel.project_dir%/var/sessions',
+ ],
+ ]);
.. _name:
diff --git a/session/database.rst b/session/database.rst
index 56cd9e27384..fa6a1e41caf 100644
--- a/session/database.rst
+++ b/session/database.rst
@@ -11,6 +11,64 @@ across different servers.
Symfony can store sessions in all kinds of databases (relational, NoSQL and
key-value) but recommends key-value databases like Redis to get best performance.
+Define Session Storage by DSN
+-----------------------------
+
+Besides specifying a service as the session-handler you can also provide a
+"DSN" directly and let Symfony create the necessary services/clients:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/framework.yaml
+ framework:
+ session:
+ # ...
+ handler_id: 'redis://password@redis-server:6379'
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->loadFromExtension('framework', [
+ 'session' => [
+ // ...
+ 'handler_id' => 'redis://password@redis-server:6379',
+ ],
+ ]);
+
+Supported DSN protocols are:
+
+- file (i.e.: ``file://%kernel.project_dir%/var/sessions``)
+- redis (i.e.: ``redis://redis-server:6379``)
+- rediss
+- memcached
+- pdo_oci
+- mssql
+- mysql
+- mysql2
+- pgsql
+- postgres
+- postgresql
+- sqlsrv
+- sqlite
+- sqlite3
+
Store Sessions in a key-value Database (Redis)
----------------------------------------------