Device Tracking in Laravel

Device Tracking in Laravel

Laravel Device Tracking is a package by Ivano Matteo that allows you to track different devices used by users of your application. You can use this package as a base for functionality like detecting users on new devices and managing the verified status between device and user. You could also possibly see device hijacking.

The package works by adding the UseDevices trait to your application’s User model:

use IvanoMatteo\LaravelDeviceTracking\Traits\UseDevices;

class User extends Authenticatable

    use HasFactory, Notifiable, UseDevices;
    // ...

The UseDevices trait gives you access to a devices() (belongs to many) relationship to get verified devices:


Here are some examples of methods you can access via the package’s facade:

use IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingFacade as DeviceTracker;



// Flag as verified for the current user

// Flag as verified for a specific user
DeviceTracker::flagAsVerified($device, $user_id);

// Flag as verified for a specific user by device UUID
DeviceTracker::flagAsVerifiedByUuid($device_uuid, $user_id);

You can learn more about this package, get full installation instructions, and view the source code on GitHub at ivanomatteo/laravel-device-tracking.

This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks

Filed in: News / laravel / packages


Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Laravel Senior Developer
Remote, Canada Only
BeMo Academic Consulting
Senior Fullstack Developer / Architect (w/m/d)
Remote / Munich - Germany GmbH
Medior full stack developer (Laravel)
Deventer (or remote) in the Netherlands, Dutch speaking required.
Senior Full Stack PHP Developer (Laravel)
Senior Laravel Developer