jeffersongoncalves / filament-session-management
A Filament plugin to read and manage Laravel's database sessions: see who is logged in, inspect decoded payloads, revoke and prune sessions from your panel.
Package info
github.com/jeffersongoncalves/filament-session-management
pkg:composer/jeffersongoncalves/filament-session-management
Requires
- php: ^8.2
- filament/filament: ^5.3
- jeffersongoncalves/filament-plugin-core: ^3.0
- jeffersongoncalves/laravel-session-management: ^1.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Filament Session Management
A Filament plugin to read and manage Laravel's database sessions from your panel: see who is logged in, from which IP and device, inspect decoded session payloads, revoke sessions and prune expired ones. It is built on top of the framework-agnostic jeffersongoncalves/laravel-session-management core and the shared jeffersongoncalves/filament-plugin-core.
Features
- 👥 Sessions table with user, IP address, user agent, last activity and an Active / Expired / Current badge
- 🔎 Filters by status (active / expired) and by authenticated vs guest sessions
- 🧾 View page with the decoded payload as pretty JSON (CSRF token and password hashes masked, objects never instantiated)
- 🚪 Revoke a session, or many in bulk; your own current session is always kept
- 🧹 "Prune expired" header action
- 🔢 Navigation badge with the number of active sessions
- 🌍 19 languages
- ⚙️ Fluent customisation of the navigation group, sort, icon, slug and user attribute
Compatibility
| Plugin Version | Filament |
|---|---|
| 1.x | 3.x |
| 2.x | 4.x |
| 3.x | 5.x |
Installation
composer require jeffersongoncalves/filament-session-management:"^3.0"
You can publish the config file with:
php artisan vendor:publish --tag="filament-session-management-config"
This plugin reads the table written by Laravel's
databasesession driver. Make sureSESSION_DRIVER=databaseand thesessionstable exists.
Usage
use Filament\Panel; use JeffersonGoncalves\Filament\SessionManagement\FilamentSessionManagementPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentSessionManagementPlugin::make() ->navigationGroup('System') // default: no group ->navigationSort(99) ->navigationIcon('heroicon-o-finger-print') ->slug('sessions') ->userAttribute('email'), // user column, default: name ]); }
All fluent methods are optional. Revoking deletes the session row, so its owner is logged out on the next request; a "remember me" cookie logs them back in, see the core package for details. Masked payload keys and the table/connection are configured in the core package's session-management config.
The resource has no authorization of its own: register it only on panels whose users may see every session, or add a policy for
JeffersonGoncalves\SessionManagement\Models\Session.
Configuration
return [ 'navigation' => [ 'group' => null, 'sort' => null, 'icon' => 'heroicon-o-finger-print', ], 'resource' => [ 'slug' => 'sessions', 'user_attribute' => 'name', ], ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
