auth:attempt, auth:login). It complements existing security measures (e.g., 2FA, rate-limiting) by adding device fingerprinting and geolocation tracking for user sessions.UserDeviceTracker and LocationService), which can be decoupled from Filament if needed (e.g., for API-based tracking).Authenticatable events) without forcing a monolithic architecture. Key integration points:
app/Http/Kernel.php to track devices on login.AuthAttempting, Authenticated, and Logout events (standard Laravel events).user_devices table (migration provided) to store device metadata (IP, user agent, geolocation).UserDeviceTracker) can still be used independently.LocationService). Assess whether this is a third-party API (cost, rate limits) or a self-hosted solution.| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Filament Version Lock | Package may assume Filament v2+. Check compatibility with your Filament version. | Test with your Filament version; fork if needed. |
| Geolocation Service | LocationService dependency may introduce latency or cost. |
Evaluate alternatives (e.g., self-hosted IP geolocation DB like geoip2). |
| Event Hooks | Assumes standard Laravel auth events. Custom auth? (e.g., Sanctum, Passport) | Verify event compatibility; may need middleware adjustments. |
| Database Schema | Migration adds user_devices table. Potential conflicts with existing schemas. |
Review migration; consider customizing table names or columns. |
| Undocumented Features | Limited docs; production-ready but untested for edge cases. | Write integration tests; monitor logs for unexpected behavior. |
| Performance | Device tracking adds DB writes on auth events. High-traffic impact? | Benchmark; consider async processing (e.g., queues) for non-critical tracking. |
UserDeviceTracker) can be adapted.composer require moox/user-device
php artisan vendor:publish --tag="user-device-migrations"
php artisan vendor:publish --tag="user-device-config"
php artisan migrate
config/user-device.php (e.g., geolocation service, retention policies).UserDeviceMiddleware in app/Http/Kernel.php:
protected $middleware = [
\Moox\UserDevice\Http\Middleware\UserDevice::class,
];
AppServiceProvider:
$this->app->bind(\Moox\UserDevice\Contracts\UserDeviceTracker::class, \Moox\UserDevice\Services\UserDeviceTracker::class);
php artisan vendor:publish --tag="user-device-filament"
app/Providers/Filament/AdminPanelProvider.php.| Component | Compatibility Notes |
|---|---|
| Laravel | Tested on Laravel 10+. Ensure your version is supported. |
| Filament | Requires Filament v2+. Check for breaking changes if using v1. |
| PHP | PHP 8.1+. No major version constraints. |
| Database | MySQL/PostgreSQL (standard Laravel support). |
| Geolocation Service | Default may use external APIs. Replace with LocationService implementation if needed. |
UserDeviceMiddleware and UserDeviceTracker.LocationService (test with mock data first).user_devices table may grow with user base. Consider archiving old records.user_id, last_seen_at for query performance.config/user-device.php (easy to override).UserDevice events for troubleshooting (e.g., failed geolocation).user_devices insert. For high traffic:
queue:work) to defer writes.user_devices table growth.LocationService.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Geolocation API downtime | Missing location data | Fallback to IP-only tracking. |
| Database connection issues | Failed device tracking | Retry logic or queue delayed writes. |
| Filament resource errors | Admin UI broken | Disable Filament or rollback. |
| Auth event conflicts | Tracking |
How can I help you explore Laravel packages today?