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

Saiffil's avatar

Persisting Session Value

Hi,

My apps broken on the latest build of laravel 5. Basically i have a service provider which set session values and were used throughout the apps.

After the latest changes on laravel/laravel and laravel/framework, the session doesn't persist anymore.

If i set the session anywhere else e.g on the route or controller, it will persist.

It seems like, session values set on service providers got flushed away.

Any thought please?

0 likes
1 reply
lprice's avatar

Not so sure if anything should be persisted anyway inside of a "Service Provider" as it is job is to provide as service to framework, thus I think some core framework classes are not present e.g. session. Guess the question you need to ask is... why am I persisting something to a session from inside a "Service Provider". In my humble opinion nothing of the sort or e.g. session values, database values etc. should be done inside a service provider. Hope that helps.

Please or to participate in this conversation.