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

antoniomadonna's avatar

Reading Session data in routes.php

Hi, do you know if there a way to read Session data before the StartSession middleware is loaded ? (or better: how to load that middleware before routes.php ?)

I'm storing the choosen site language in session and I need it to implement some routes... any hints ?

Thank you!

0 likes
2 replies
antoniomadonna's avatar

Thank you! I did create the custom event as mentioned in that post.

Now I just have "ugly" routes (with full namespace) since Laravel doesn't seem to set the controllers namespace when defining routes in a closure. But that's not a big problem.

Please or to participate in this conversation.