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

fgunz06's avatar

Auth user session expire event

hello guys , I wanna ask , is their a way to call a function/event when auth user session expires when user didnt do any activity in the app ?

0 likes
3 replies
Snapey's avatar

No. Everything runs off a request cycle. No request, no processing.

Your user goes away and their session details are just held in storage. Nothing happens on either side.

The following day, at the client, you request to access the server, your browser sees if it has any cookies it can send to the server, but by this time the session cookie has expired so it does not send it.

At the server it gets a request from the client, does not recognise the client and starts a new session.

Sometime later, on random requests, Laravel garbage collects the session store and deletes out of date session files.

So, session expiry is not an event that can be managed.

fgunz06's avatar

sir thankyou for your reply do you have idea how can I trigger function when session expired ? I need function to update a column in db when session expired .

Please or to participate in this conversation.