overtrue/laravel-stateless-session
Stateless session driver for Laravel that keeps session data in signed cookies instead of server-side storage. No Redis, database, or files required, so sessions work across servers and scale horizontally. A drop-in driver that preserves the familiar session API while removing shared session state.
undefined/0 inbound values, and return the final session ID after regeneration or invalidation — makes "session ID is a client-held resource" an explicit contract. This supports decisions about login/logout flows, token refresh, and analytics session stitching, and closes a class of confusing "my session disappeared after login" bugs.Access-Control-Expose-Headers) and middleware registration differs under Laravel 13. This forces an explicit CORS and middleware-ordering decision that is easy to get wrong and hard to debug.Adopt when:
Look elsewhere or defer when:
Upgrade prerequisites to verify: Laravel 13 middleware registration order, Access-Control-Expose-Headers for the session header, custom header-name configuration preserved, and a client release that persists the latest session ID from both success and error responses.
For executives: This is a small, single-purpose dependency that lets our Laravel backend keep first-class session features — CSRF protection, flash messages, form/validation state — without relying on browser cookies. That matters because cookie-based flows are increasingly unreliable for cross-domain SPAs and mobile clients. Release 3.0.0 is a maintenance and hardening release, not a feature investment: it aligns the package with Laravel 13 and PHP 8.3+, fixes incorrect session IDs after login/logout regeneration, removes broken install hooks, and adds meaningful automated test coverage and dependency auditing. Cost is low; the main work is sequencing, not engineering.
For engineering: 3.0.0 is a breaking major. It requires Laravel 13 and PHP 8.3+, drops Laravel 9 and older runtimes, and changes the header contract: the session header is returned on the first request and for missing/empty/undefined/0 inbound values, no session ID is exposed when no Laravel session is attached, and the final session ID is returned after regeneration or invalidation. Custom header names, cookie precedence, persistent data, and malformed-ID validation are preserved. Docs now cover Laravel 13 middleware registration, CORS exposure, and an Axios interceptor pattern that retains session IDs from both successful and rejected responses without swallowing errors. Composer's broken cghooks hooks are gone. Verification is stronger: 22 new tests / 134 assertions over real middleware execution, file-backed persistence, and error paths, with CI across PHP 8.3, 8.4, and 8.5, lowest secure dependencies, style checks, and audits.
Recommendation: Treat this as a coordinated backend + client release tied to the Laravel 13 migration. Read UPGRADE.md first, upgrade the application framework, then composer require overtrue/laravel-stateless-session:^3.0 --with-all-dependencies. Ship the client interceptor change in the same window — the new first-request and error-response header behavior changes what clients see, and staggered rollout is the primary risk here. If the Laravel 13 migration is not on the near-term roadmap, hold at 2.x and plan the move with the framework upgrade.
How can I help you explore Laravel packages today?