jeffersongoncalves/laravel-session-management
Laravel Session Management lets you track and manage active user sessions stored in the database, so users can review logged-in devices and revoke or log out other sessions. Lightweight package for secure session control.
Session::forUser() plus SessionManagement::revoke() and revokeUser() make it cheap to ship a security settings screen listing a user's active sessions with per-device revoke — a recurring check-box item in enterprise and consumer security reviews.sessions table — it removes the argument for a session-management service or a custom internal admin panel for the common case.session-management:prune replaces ad-hoc cleanup queries with a schedulable command, informing decisions about session lifetime (session.lifetime) and database growth.guests(), authenticated(), active(), expired() scopes give support staff self-serve answers ("is this user actually logged in right now?") without engineering involvement._token and password_hash_* in decodePayload() supports safe logging/export in GDPR and audit contexts, reducing review friction.Adopt when:
session.table / session.connection, so Redis or file sessions are out of scope.session.encrypt configuration — verify this before enabling in environments with key rotation or multi-app shared tables.Look elsewhere or build in-house when:
Open questions to resolve before committing: payload decode behavior across mixed serializers, whether revokeUser() can exclude the current session (essential for "log out other devices"), and whether pruning respects session.lottery so the command doesn't double up on Laravel's built-in GC.
For executives: A small, focused addition that closes a standard security gap — users and support teams can see and kill active sessions, and we can force-logout a compromised account in one action. It reuses our existing session infrastructure, so there is no new service, no new vendor, and no data migration.
For engineering: A read/write wrapper over Laravel's sessions table that respects session.table, session.connection, session.encrypt, and session.serialization, so it behaves like the framework rather than alongside it. It offers an Eloquent model with user(), scopes (active, expired, guests, authenticated, forUser), a payload decoder that never instantiates objects and masks _token/password_hash_* by default, plus revoke/revokeUser/prune and an artisan prune command for scheduling.
Caveats to state plainly: database driver only; v1.0.0 is the first release, so pin it and expect to review upgrades; session metadata beyond what the table stores (IP, user agent) is on us if we want richer device listings.
How can I help you explore Laravel packages today?