Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

New in Symfony 4.3: Configurable Session ID

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

Contributed by
Anthony Martin
in #30027.

PHP defines lots of config options related to sessions. In Symfony we define them under the framework.session.* options so you don't have to change your PHP.ini to configure those values.

In Symfony 4.3 we added two new config options related to session IDs:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# config/packages/framework.yaml
framework:
    session:
        # configures the length of the string used for the session ID
        # integer; default = 32; valid values = from 22 to 256 (both inclusive)
        sid_length: 64

        # configures the number of bits in encoded session ID character
        # integer; default = 4; valid values: 4, 5, or 6.
        sid_bits_per_character: 4

These new options are related to the session.sid_length PHP option and the session.sid_bits_per_character PHP option respectively, where you can find more details about them.

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.

Comments

Nice.
good Job
Great feature!
Great, thanks
Awesome!

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.