Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Devices Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Laravel Devices Documentation

Latest Version on Packagist Total Downloads PHP Version Static Badge License: MIT GitHub last commit Hits-of-Code wakatime

Documentation

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.

Getting Started

Core Concepts

Features

Developer Reference

Requirements

  • PHP 8.2 or higher
  • Laravel 10.x or 11.x
  • Redis extension (recommended for caching)

Quick Installation

composer require diego-ninja/laravel-devices

Basic Usage

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
}

Upgrade 1.2.x to 2.0

The upgrade should be smooth with just a couple of change that need to be taken care of.

Potential breaking changes:

  • the 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;
  • configuration file has been refactored. Old variable names are still supported. See the config file to check the new namings.

Other important changes:

  • model history is now supported through the 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:
    • device_id: is an anonymous unique device identifier.
    • advertising_id: is a unique, user-resettable, and user-deletable ID for advertising - (Google, Apple)

Credits

This project is developed and maintained by 🥷 Diego Rin and Davide Pizzato in their free time.

License

The MIT License (MIT). Please see License File for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport