PHPackages                             omidgfx/laravel-agent-detector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. omidgfx/laravel-agent-detector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

omidgfx/laravel-agent-detector
==============================

Laravel wrapper for matomo-org/device-detector user agent parser

03PHP

Since Nov 15Pushed 2y agoCompare

[ Source](https://github.com/omidgfx/laravel-agent-detector)[ Packagist](https://packagist.org/packages/omidgfx/laravel-agent-detector)[ RSS](/packages/omidgfx-laravel-agent-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Agent Detector
======================

[](#laravel-agent-detector)

[![Latest Stable Version](https://camo.githubusercontent.com/4c23e0e8465a1dd864945213f3efa95f948fe0733ee84bbbef9fd4a42037ca57/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726d656e6472612f6c61726176656c2d6167656e742d6465746563746f722e737667)](https://packagist.org/packages/karmendra/laravel-agent-detector) [![Total Downloads](https://camo.githubusercontent.com/f142233fd4f034c05c4880bf3ccb632142e0411bffad813bd79e8ed2e6befab6/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6b61726d656e6472612f6c61726176656c2d6167656e742d6465746563746f722e737667)](https://packagist.org/packages/karmendra/laravel-agent-detector)

A PHP desktop/mobile user agent parser for Laravel, based on [Device Detector](https://github.com/matomo-org/device-detector) that will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.

Goto  for a quick demo of what this library can detect.

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

[](#installation)

Install using composer:

```
composer require karmendra/laravel-agent-detector
```

Laravel (optional)
------------------

[](#laravel-optional)

Add the service provider in `config/app.php`:

```
Karmendra\LaravelAgentDetector\AgentDetectorServiceProvider::class,
```

And add the AgentDetector alias to `config/app.php`:

```
'AgentDetector' => Karmendra\LaravelAgentDetector\Facades\AgentDetector::class,
```

Basic Usage
-----------

[](#basic-usage)

Start by creating an `AgentDetector` instance (or use the `AgentDetector` Facade):

```
use Karmendra\LaravelAgentDetector\AgentDetector;

$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2';
$ad = new AgentDetector($user_agent);
```

If you want set different user agents on the fly in CLI scripts for example, you can use the setUserAgent

```
$ad->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2');
```

All of the original [Device Detector](https://github.com/matomo-org/device-detector) methods are still available

Additional Functionality
------------------------

[](#additional-functionality)

### Device type

[](#device-type)

Get the device type. (`smartphone`, `mobile`, `tablet`, `desktop`, `bot` ...)

```
$type = $ad->device();
```

### Device brand name

[](#device-brand-name)

Get the device manufactures brand name, if mobile. (`Apple`, `Nexus`, `Samsung`, ...)

```
$brand = $ad->deviceBrand();
```

### Device model

[](#device-model)

Get the device model, if mobile. (Apple: `iPhone`, Samsung: `Galaxy S9` ...)

```
$model = $ad->deviceModel();
```

### Platform / Operating system name

[](#platform--operating-system-name)

Get the operating system. (`Ubuntu`, `Android`, `Windows`, `Mac`, `iOS`, ...)

```
$platform = $ad->platform();
```

### Platform version (OS version).

[](#platform-version-os-version)

Get the platform version. (Windows: `10`, Mac: `10.11`, Android: `9.0`, ...)

```
$platform_version = $ad->platformVersion();
```

### Browser name

[](#browser-name)

Get the browser name. (`Chrome`, `IE`, `Safari`, `UC Browser`, ...)

```
$browser = $ad->browser();
```

### Browser version

[](#browser-version)

Get the browser name. (Chrome: `56`, Safari: `9.0`, Firefox: `48`, ...)

```
$browser_version = $ad->browserVersion();
```

### Robot detection

[](#robot-detection)

Check if the user is a robot. (`true` or `false`)

```
$ad->isBot();
```

To-do (PR welcome):
-------------------

[](#to-do-pr-welcome)

- Adding test cases
- Adding additional functions for getting robot info, enable disable robot detection etc.

License
-------

[](#license)

Laravel Agent Detector is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/eeeb3e8d7ebbb9676cff4cdc78d58852f5be28a913f6ffe0607666c461be9726?d=identicon)[omidgfx](/maintainers/omidgfx)

---

Top Contributors

[![karmendra](https://avatars.githubusercontent.com/u/11293052?v=4)](https://github.com/karmendra "karmendra (4 commits)")[![omidgfx](https://avatars.githubusercontent.com/u/3041998?v=4)](https://github.com/omidgfx "omidgfx (2 commits)")

### Embed Badge

![Health badge](/badges/omidgfx-laravel-agent-detector/health.svg)

```
[![Health](https://phpackages.com/badges/omidgfx-laravel-agent-detector/health.svg)](https://phpackages.com/packages/omidgfx-laravel-agent-detector)
```

PHPackages © 2026

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