Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

peterlee's avatar

how session works in Laravel?

I though the session is shared through all app user who use backend server, Laravel,

so let's say there are user1, user2, user3, and if user1 create session by session key, 'auth_user', and what I though is that user2 and user3 also could access to session value only if user2, 3 know what's session_key

so if a user1 call

session([ 'auth_user' => 'test'] );

then session would be stored by session key, 'auth_user'.

but this session is only accessible by user1, but not user2, user3

how is that possible and how do Laravel know user1 identification as session is only accessable who create that session?

0 likes
0 replies

Please or to participate in this conversation.