PHPackages                             karmendra/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. karmendra/laravel-agent-detector

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

karmendra/laravel-agent-detector
================================

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

v1.1(4y ago)1249.6k↑45.2%3[1 PRs](https://github.com/karmendra/laravel-agent-detector/pulls)MITPHP

Since Feb 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/karmendra/laravel-agent-detector)[ Packagist](https://packagist.org/packages/karmendra/laravel-agent-detector)[ Docs](https://github.com/karmendra/laravel-agent-detector)[ RSS](/packages/karmendra-laravel-agent-detector/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (1)Versions (3)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

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~619 days

Total

2

Last Release

1711d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11293052?v=4)[Karmendra Suthar](/maintainers/karmendra)[@karmendra](https://github.com/karmendra)

---

Top Contributors

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

---

Tags

browserlaraveluseragentmobileuser agentplatformdesktopAgentdevice detector

### Embed Badge

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

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

###  Alternatives

[jenssegers/agent

Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

4.8k72.3M516](/packages/jenssegers-agent)[hisorange/browser-detect

Browser &amp; Mobile detection package for Laravel.

1.1k10.9M61](/packages/hisorange-browser-detect)[al-saloul/agent

Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

1516.6k1](/packages/al-saloul-agent)

PHPackages © 2026

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