Symfony session (stand alaone) cookiename

1.9k Views Asked by At

I use the Symfony http foundation stand alone (aka i installed the http-foundation package with composer inside my non-symfony project). Ik would like to change the name of the session cookie. What would be my best way to achieve this?

I read a lot of items regarding this issue, most of them are about configuring the cookie name in the Symfony config.yml settings file which i do not have (stand-alone usage).

Any tips?

1

There are 1 best solutions below

1
On

You can use Session::setName() instead of session_name().

See this here for Symfony 5.3 and here for Symfony 6 & more