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

omrakhurs's avatar

Gracefully redirecting user after session expires

I would like to know if there's a way to bring a user to the login page if the session is about to expire? I'm using laravel 5.2 and the only way I know if the session is expired is to wait for the number of minutes defined in config/session.php and then click on a link, upon which it shows me a lot of ErrorExceptions with the message "Trying to get property of non-object (View:...blah dee blah". Once I click refresh after this error page appears, it then takes me to the login screen.

I'm open to any and all techniques here about how others have handled this.

0 likes
1 reply

Please or to participate in this conversation.