Replies: 3 comments 2 replies
-
the purpose of it is to be able to configure multiple session store with the same driver. say you have |
Beta Was this translation helpful? Give feedback.
-
Hello, a bit late but I noticed this today. |
Beta Was this translation helpful? Give feedback.
-
The SESSION_DRIVER defines the mechanism that will be used to store sessions (f.e., SESSION_DRIVER=redis). The SESSION_CONNECTION defines the specific connection (for the "database" or "redis" drivers). The SESSION_STORE is an alternative to the SESSION_CONNECTION. By using a store, you can define NOT ONLY the connection but also additional parameters (e.g., a prefix for all keys stored). SESSION_CONNECTION vs SESSION_STORE? 🤔Use SESSION_CONNECTION if you need to control only the host/port/database: 'sessions' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_SESSION_DB', '2'),
], Use SESSION_STORE if the separation that SESSION_CONNECTION gives is NOT ENOUGH for you, and you need to specify additional params (prefix, etc.) (For example, you'd want to use SESSION_STORE when your staging and production use the same Redis connection, and you want to force different prefixes for them) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
There seem to be 2 configurations named
SESSION_DRIVER
andSESSION_STORE
inconfig/session.php
as seen here:However, they seem to do the exact same thing. When I look at the SessionManager, it just looks like
config('session.store')
takes precedence over the other value:framework/src/Illuminate/Session/SessionManager.php
Lines 163 to 177 in 78cb588
Anyone know whats up, or what the use case is for these 2 separate variables?
Beta Was this translation helpful? Give feedback.
All reactions