PHPackages                             ivanomatteo/laravel-device-tracking - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ivanomatteo/laravel-device-tracking

ActiveLibrary

ivanomatteo/laravel-device-tracking
===================================

a library that allow to track different devices used

1.0.0(1y ago)28160.7k↓14.3%29MITPHPPHP &gt;=8.0

Since Oct 20Pushed 1y ago14 watchersCompare

[ Source](https://github.com/ivanomatteo/laravel-device-tracking)[ Packagist](https://packagist.org/packages/ivanomatteo/laravel-device-tracking)[ Docs](https://github.com/ivanomatteo/laravel-device-tracking)[ RSS](/packages/ivanomatteo-laravel-device-tracking/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (15)Used By (0)

A library that allows you to track different devices used per user
==================================================================

[](#a-library-that-allows-you-to-track-different-devices-used-per-user)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fcf33c60ec7838dbda3d80b92e3a423f57ea5eed8b1c02acaac9fb41c1496c62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976616e6f6d617474656f2f6c61726176656c2d6465766963652d747261636b696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/laravel-device-tracking)

[![Total Downloads](https://camo.githubusercontent.com/94f69227ae89c7451b280f51823ef14996711f542b6c1e4b4adf0e862d255770/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976616e6f6d617474656f2f6c61726176656c2d6465766963652d747261636b696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/laravel-device-tracking)

This package implements a "google like" device detection.

You can detect when a user is using a new device and manage the verified status between user and device.

You can also detect a possible device hijacking.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ivanomatteo/laravel-device-tracking
```

Publish migrations:

```
php artisan vendor:publish --provider "IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingServiceProvider" --tag migrations
```

Run migrations:

```
php artisan migrate
```

Publish config file:

```
php artisan vendor:publish --provider "IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingServiceProvider" --tag config
```

Usage
-----

[](#usage)

```
use IvanoMatteo\LaravelDeviceTracking\Facades\DeviceTracker;
use IvanoMatteo\LaravelDeviceTracking\Traits\UseDevices;
use IvanoMatteo\LaravelDeviceTracking\Models\Device;

// add the trait to your user model
class User {
    use UseDevices;
}

// call on login or when you want update and check the device informations
// by default this function is called when the Login event is fired
// only with the "web" auth guard
// if you want you can disable the detect_on_login option in the config file
$device = DeviceTracker::detectFindAndUpdate();

// flag as verified for the current user
DeviceTracker::flagCurrentAsVerified();

// 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);

DeviceTracker::flagCurrentAsRogue($note = null, $adminNote = null, $data = null);
DeviceTracker::flagAsRogue($device, $user_id = null, $note = null, $adminNote = null, $data = null);
```

If you are using Session Authentication it's possible to add the middleware **IvanoMatteo\\LaravelDeviceTracking\\Http\\Middleware\\DeviceTrackerMiddleware** in app/Http/Kernel.php, at the end of **web** group.

This way, the device will also be checked for **subsequents** requests to the login request. **DeviceTrackerMiddleware** will store the md5(request()-&gt;ip() . $device\_uuid . $user\_agent ) inside the session so the detection will be executed again only if the hash does not match.

Following events can be emitted:

- **DeviceCreated**

    when a new device is detected and stored
- **DeviceUpdated**

    when some information of a device is changed
- **DeviceHijacked**

    when critical device information is changed. You can also define a custom **DeviceHijackingDetector**. After this event, the device will be updated, and the next time, DeviceHijacked will not be emitted, but the device will have the field **device\_hijacked\_at**with the last DeviceHijacked event timestamp.
- **UserSeenFromNewDevice**

    when a user is detected on a device for the first time
- **UserSeenFromUnverifiedDevice**

    when a user is detected on a device not for the first time and the device is not flagged as verified
- **UserSeenFromRogueDevice**

    when a user is detected on a device flagged as "rougue"

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ivano Matteo](https://github.com/ivanomatteo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 92.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~111 days

Recently: every ~331 days

Total

13

Last Release

698d ago

Major Versions

0.2.1 → 1.0.02024-06-19

PHP version history (3 changes)0.1.0PHP ^7.1

0.1.9PHP &gt;=7.1

1.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35255310?v=4)[Ivano Matteo](/maintainers/IvanoMatteo)[@ivanomatteo](https://github.com/ivanomatteo)

---

Top Contributors

[![ivanomatteo](https://avatars.githubusercontent.com/u/35255310?v=4)](https://github.com/ivanomatteo "ivanomatteo (63 commits)")[![hotmeteor](https://avatars.githubusercontent.com/u/378585?v=4)](https://github.com/hotmeteor "hotmeteor (1 commits)")[![jonnott](https://avatars.githubusercontent.com/u/472468?v=4)](https://github.com/jonnott "jonnott (1 commits)")[![joseborges](https://avatars.githubusercontent.com/u/7250506?v=4)](https://github.com/joseborges "joseborges (1 commits)")[![snipe](https://avatars.githubusercontent.com/u/197404?v=4)](https://github.com/snipe "snipe (1 commits)")[![yurirnascimento](https://avatars.githubusercontent.com/u/4502631?v=4)](https://github.com/yurirnascimento "yurirnascimento (1 commits)")

---

Tags

ivanomatteolaravel-device-tracking

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ivanomatteo-laravel-device-tracking/health.svg)

```
[![Health](https://phpackages.com/badges/ivanomatteo-laravel-device-tracking/health.svg)](https://phpackages.com/packages/ivanomatteo-laravel-device-tracking)
```

###  Alternatives

[fresns/fresns

Cross-platform general-purpose multiple content forms social network service software.

4841.5k](/packages/fresns-fresns)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[ivanomatteo/laravel-scout-fulltext-engine

A scout DB fulltext-based driver that store index data in related tables

101.1k](/packages/ivanomatteo-laravel-scout-fulltext-engine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
