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

viglucci's avatar

Session expire event?

I am looking to see if there is a event that is fired when a session is expired?

I want to perform some database actions when a session is automatically destroyed or expired by the framework, so that I can update a column in the user table.

When the session expires, I need to get the user for whom the session belonged to, if any, and then update a column in the user table.

Is there a event that is fired when a session expires?

0 likes
3 replies
IndustryArena's avatar

I have a similar situation. When session expired i need to perform some actions. At the moment as a session driver i have Redis. What would be a best solution for that?

JMarcher's avatar

You can extend the SessionManager and overwide the createCacheHandler() method to return your own CacheBasedSessionHandler.

Inside the CacheBasedSessionHandler is where the destroy() method resides, there you should be able to fire an event and then destroy the session.

Please or to participate in this conversation.