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

Thijmen's avatar

Session in Handler.php

Hello folks!

I am trying to send my Exceptions to Sentry. (getsentry.com). I also want to add some context. For example, I want to send with the Exception the current user or the active site (I build a multi-site tool), which is stored in my session.

But I think the session isn't setup yet when the Handler.php is called, because when I do dd(session()) I get null.

Is there some way to archive what i want?

0 likes
4 replies
Thijmen's avatar

Sentry works perfectly, but I want to send some session vars with the exception. It looks like the Session isn't initialized before the Handler.php. @TaylorOtwell is this even possible?

Please or to participate in this conversation.