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

Jmrtech's avatar

Session flush removing all stored sessions

I am using a file based session driver in my app. A user can make a request via text message and a session is created with all of the information that is need. The problem I am running into is when a users request has been made I flush the data from that session, but all session data is being remove rather than just for that session. I was originally using the global session()->flush(), and then started using $request->session->flush() hoping that it would correct the problem. Not sure why I can't get it to remove just the current sessions data.

0 likes
1 reply
apacheguy's avatar

if i get u correctly, session->flush() will flush away all the session data, instead use session->forget('key'), with the key parameter, you are specifying which data you wish to clear...i hope this solves the problem.

Please or to participate in this conversation.