overtrue/laravel-single-session
Prevent concurrent logins in Laravel by limiting each user to a single active session. When a user signs in from a new device or browser, earlier sessions are invalidated automatically, keeping accounts secure with minimal setup.
Architecture fit. The package is a thin Laravel service provider plus middleware that hooks into the native Auth/session lifecycle to keep one active session per user. That shape is architecturally compatible with Laravel’s guard/session abstractions, but it targets the Laravel 5.5–5.6 era (last release December 2017). On any modern Laravel (8.x–12.x) the overlapping native primitives — Illuminate\Session\Middleware\AuthenticateSession, Auth::logoutOtherDevices(), and the password_hash column — already cover most of the stated value proposition, so the package is largely redundant where it still works and broken where it would be needed.
Integration feasibility. Public signals are weak: 17 stars, a composite score of 0.1375, archived repository, no release since 2017. Expect Composer constraints against illuminate/support/illuminate/session in the ^5.5 range, PHP ^7.0-era requirements, and no CI/test evidence. Installing on a current Laravel app will likely fail dependency resolution or require --ignore-platform-reqs and constraint overrides — a maintenance liability before a single line of integration code is written.
Technical risk.
AuthenticateSession semantics) after 5.6; the package’s invalidation strategy may silently no-op rather than fail loudly.Key questions.
sessions table (driver-specific) or on a cache key?Recommendation: do not adopt. Replace with native Laravel primitives or a small in-house listener.
Stack fit. Fits only a legacy Laravel ≤5.6 application using a shared session backend. On a modern stack it is a net-negative: redundant behavior, dependency conflicts, and an unmaintained package in the auth path. Score and archive status alone disqualify it for anything security-sensitive.
Migration path (replacement, not adoption).
AuthenticateSession middleware on authenticated route groups; add the password_hash column (or an equivalent custom guard) so password changes invalidate other sessions.Auth::logoutOtherDevices($password) where the UX calls for "sign out everywhere else," or implement a ~40-line Login event listener that stores the current session ID per user in Redis/DB and invalidates prior IDs.Compatibility. Validate against the actual session driver matrix. File-driver sessions on multi-node deployments cannot be reliably invalidated from another node without shared storage; Redis/database drivers are required for deterministic behavior. Confirm the replacement works with "remember me" tokens, API guards (Sanctum), and any custom guards before rollout.
Sequencing. (1) Inventory apps and Laravel versions; (2) confirm requirement with security/product — single-session vs. logout-other-devices vs. concurrent-login alerting; (3) prototype native approach in staging against the real session driver; (4) roll out behind a feature flag with login-failure dashboards; (5) remove any package references and update the dependency policy to block archived packages in auth-critical paths.
Maintenance. An archived package is a permanent maintenance tax: every Laravel/PHP upgrade becomes a manual compatibility investigation, and any fork we create becomes our code to own, test, and patch. Native primitives are maintained by the framework and covered by Laravel’s release/security process.
Support. No upstream support, no issue triage, no security contact. Internal on-call would own any auth incident traced to the package with no escalation path — unacceptable for a component whose failure mode is "users cannot log in" or "old sessions stay valid."
Scaling. Correctness depends on a shared, low-latency store for the per-user session pointer and on consistent session storage across nodes. Horizontal scaling with file-based sessions will produce non-deterministic invalidation. Cache eviction or TTL expiry can either leave stale sessions authenticated (security gap) or lock out the legitimate user (availability gap), with no telemetry from the package to distinguish the two.
Failure modes.
Ramp-up. The codebase is small and a mid-level engineer can replicate its behavior natively in one to two days, including tests. Ramp-up on the package itself is low but yields knowledge of an unsupported artifact; that effort is better spent on the native replacement, which also produces code the team can maintain.
How can I help you explore Laravel packages today?