diego-ninja/laravel-devices
Laravel package for tracking authenticated user devices and managing sessions. Includes device verification, fingerprinting integrations, session locking/blocking with optional Google 2FA, location tracking, events, middleware/controllers, and caching support.
This documentation has been generated almost in its entirety using 🦠 Claude 3.5 Sonnet based on source code analysis. Some sections may be incomplete, outdated or may contain documentation for planned or not-released features. For the most accurate information, please refer to the source code or open an issue on the package repository.
If you find any issues or have suggestions for improvements, please open an issue or a pull request on the package repository.
composer require diego-ninja/laravel-devices
Include in your middleware stack both DeviceTracker::class and SessionTracker::class in this order or simply use
the managers like this:
// Track current device
$device = DeviceManager::track();
// Start a new session
$session = SessionManager::start();
// Check device status
if ($device->verified()) {
// Process request
}
The upgrade should be smooth with just a couple of change that need to be taken care of.
Potential breaking changes:
Device model has lost the ip value. The ip is now only available through the Session model;user_devices table has been dropped since it was containing only data duplicated from the devices table.
The relation HasManyDevices has been properly updated, using the already available device_sessions intermediate table.
All uses of the HasManyDevices relation should not change;Other important changes:
history table, logging column changes of devices and session tables;fingerprint is now always active and simply ignored when not available in the request.fingerprint transport has been refactored and standardized like session and device transports;Device model identification has improved. The model has been enriched with two new values, that can both be used separately to identify the physical devices
proved the platform and the browsers stays the same:
This project is developed and maintained by 🥷 Diego Rin and Davide Pizzato in their free time.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?