PHPackages                             sureshinde/mobile-desktop-detect - 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. sureshinde/mobile-desktop-detect

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

sureshinde/mobile-desktop-detect
================================

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

3.0.7(2y ago)0101MITPHPPHP &gt;=8.0

Since Nov 30Pushed 2y agoCompare

[ Source](https://github.com/SureShinde/mobile-desktop-detect)[ Packagist](https://packagist.org/packages/sureshinde/mobile-desktop-detect)[ Docs](https://github.com/sureshinde/mobile-desktop-detect)[ GitHub Sponsors](https://github.com/sureshinde)[ Fund](https://tidelift.com/funding/github/packagist/sureshinde/mobile-desktop-detect)[ RSS](/packages/sureshinde-mobile-desktop-detect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (35)Used By (1)

Agent
=====

[](#agent)

[![Latest Stable Version](https://camo.githubusercontent.com/1b557e4c49977fd665982c29dc4e0d9d69e463c5d9040584bbdf3e266d2715c6/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737572657368696e64652f6d6f62696c652d6465736b746f702d6465746563742e737667)](https://packagist.org/packages/sureshinde/mobile-desktop-detect) [![Total Downloads](https://camo.githubusercontent.com/ff00e497a867cbb7330a95cf2c31aa9f5f342de380f953a2cb662aab6d084fab/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f737572657368696e64652f6d6f62696c652d6465736b746f702d6465746563742e737667)](https://packagist.org/packages/sureshinde/mobile-desktop-detect) [![Build Status](https://camo.githubusercontent.com/b8f883ebb938720592dcf2d9ce641491df037e33756f6e8fbf112650d4be1aa8/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f737572657368696e64652f6d6f62696c652d6465736b746f702d6465746563742e737667)](https://travis-ci.org/sureshinde/mobile-desktop-detect) [![Coverage Status](https://camo.githubusercontent.com/2155bf193d738e8b698f7d896de1742edf9fc1a2a14265e41cc7a0a37c9f4df8/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f737572657368696e64652f6d6f62696c652d6465736b746f702d6465746563742e737667)](https://coveralls.io/r/sureshinde/mobile-desktop-detect) [![Donate](https://camo.githubusercontent.com/d47cdb766a100070d38a702d9c7760ccc8052063484e1478a26bcd16680d33af/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d626c75652e737667)](https://www.paypal.me/sureshinde)

A PHP desktop/mobile user agent parser with support for Laravel, based on [Mobile Detect](https://github.com/serbanghita/Mobile-Detect) with desktop support and additional functionality.

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

[](#installation)

Install using composer:

```
composer require sureshinde/mobile-desktop-detect
```

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

[](#laravel-optional)

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

```
SureShinde\MobileDesktopDetect\AgentServiceProvider::class,
```

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

```
'Agent' => SureShinde\MobileDesktopDetect\Facades\Agent::class,
```

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

[](#basic-usage)

Start by creating an `Agent` instance (or use the `Agent` Facade if you are using Laravel):

```
use SureShinde\MobileDesktopDetect\Agent;

$agent = new Agent();
```

If you want to parse user agents other than the current request in CLI scripts for example, you can use the `setUserAgent` and `setHttpHeaders` methods:

```
$agent->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');
$agent->setHttpHeaders($headers);
```

All of the original [Mobile Detect](https://github.com/serbanghita/Mobile-Detect) methods are still available, check out some original examples at

### Is?

[](#is)

Check for a certain property in the user agent.

```
$agent->is('Windows');
$agent->is('Firefox');
$agent->is('iPhone');
$agent->is('OS X');
```

### Magic is-method

[](#magic-is-method)

Magic method that does the same as the previous `is()` method:

```
$agent->isAndroidOS();
$agent->isNexus();
$agent->isSafari();
```

### Mobile detection

[](#mobile-detection)

Check for mobile device:

```
$agent->isMobile();
$agent->isTablet();
```

### Match user agent

[](#match-user-agent)

Search the user agent with a regular expression:

```
$agent->match('regexp');
```

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

[](#additional-functionality)

### Accept languages

[](#accept-languages)

Get the browser's accept languages. Example:

```
$languages = $agent->languages();
// ['nl-nl', 'nl', 'en-us', 'en']
```

### Device name

[](#device-name)

Get the device name, if mobile. (iPhone, Nexus, AsusTablet, ...)

```
$device = $agent->device();
```

### Operating system name

[](#operating-system-name)

Get the operating system. (Ubuntu, Windows, OS X, ...)

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

### Browser name

[](#browser-name)

Get the browser name. (Chrome, IE, Safari, Firefox, ...)

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

### Desktop detection

[](#desktop-detection)

Check if the user is using a desktop device.

```
$agent->isDesktop();
```

*This checks if a user is not a mobile device, tablet or robot.*

### Phone detection

[](#phone-detection)

Check if the user is using a phone device.

```
$agent->isPhone();
```

### Robot detection

[](#robot-detection)

Check if the user is a robot. This uses [jaybizzle/crawler-detect](https://github.com/JayBizzle/Crawler-Detect) to do the actual robot detection.

```
$agent->isRobot();
```

### Robot name

[](#robot-name)

Get the robot name.

```
$robot = $agent->robot();
```

### Browser/platform version

[](#browserplatform-version)

MobileDetect recently added a `version` method that can get the version number for components. To get the browser or platform version you can use:

```
$browser = $agent->browser();
$version = $agent->version($browser);

$platform = $agent->platform();
$version = $agent->version($platform);
```

*Note, the version method is still in beta, so it might not return the correct result.*

License
-------

[](#license)

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

Security contact information
----------------------------

[](#security-contact-information)

To report a security vulnerability, follow [these steps](https://tidelift.com/security).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 76% 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 ~113 days

Recently: every ~0 days

Total

34

Last Release

809d ago

Major Versions

v1.0.0 → v2.0.02013-12-02

v2.6.4 → v3.0.02024-02-20

PHP version history (4 changes)v1.0.0PHP &gt;=5.3.0

v2.4.0PHP &gt;=5.4.0

v2.6.1PHP &gt;=5.6

v3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/22d1dbfaf2ce97ba98c35622a4934da8be03881728a94bc2e7b51429ba58ce9e?d=identicon)[sureshinde](/maintainers/sureshinde)

---

Top Contributors

[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (155 commits)")[![SureShinde](https://avatars.githubusercontent.com/u/229213?v=4)](https://github.com/SureShinde "SureShinde (6 commits)")[![Skaronator](https://avatars.githubusercontent.com/u/2886913?v=4)](https://github.com/Skaronator "Skaronator (5 commits)")[![mpetty](https://avatars.githubusercontent.com/u/1807888?v=4)](https://github.com/mpetty "mpetty (4 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (3 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (3 commits)")[![ThaDafinser](https://avatars.githubusercontent.com/u/533017?v=4)](https://github.com/ThaDafinser "ThaDafinser (3 commits)")[![ElfSundae](https://avatars.githubusercontent.com/u/526008?v=4)](https://github.com/ElfSundae "ElfSundae (3 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (3 commits)")[![BertKooij](https://avatars.githubusercontent.com/u/3949189?v=4)](https://github.com/BertKooij "BertKooij (2 commits)")[![jwpage](https://avatars.githubusercontent.com/u/52687?v=4)](https://github.com/jwpage "jwpage (2 commits)")[![loclv](https://avatars.githubusercontent.com/u/6302717?v=4)](https://github.com/loclv "loclv (2 commits)")[![sebastiaanspeck](https://avatars.githubusercontent.com/u/12570668?v=4)](https://github.com/sebastiaanspeck "sebastiaanspeck (2 commits)")[![KikoPalomares](https://avatars.githubusercontent.com/u/6002391?v=4)](https://github.com/KikoPalomares "KikoPalomares (1 commits)")[![nesk](https://avatars.githubusercontent.com/u/817508?v=4)](https://github.com/nesk "nesk (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (1 commits)")[![jonathan-bird](https://avatars.githubusercontent.com/u/1510001?v=4)](https://github.com/jonathan-bird "jonathan-bird (1 commits)")[![yaoshanliang](https://avatars.githubusercontent.com/u/5028569?v=4)](https://github.com/yaoshanliang "yaoshanliang (1 commits)")[![evrard-c](https://avatars.githubusercontent.com/u/23173851?v=4)](https://github.com/evrard-c "evrard-c (1 commits)")

---

Tags

detectiondetectormobilebrowserlaraveluseragentmobileuser agentplatformdesktopAgent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sureshinde-mobile-desktop-detect/health.svg)

```
[![Health](https://phpackages.com/badges/sureshinde-mobile-desktop-detect/health.svg)](https://phpackages.com/packages/sureshinde-mobile-desktop-detect)
```

###  Alternatives

[jenssegers/agent

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

4.8k67.8M439](/packages/jenssegers-agent)[hisorange/browser-detect

Browser &amp; Mobile detection package for Laravel.

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

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

1511.5k1](/packages/al-saloul-agent)[karmendra/laravel-agent-detector

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

1241.6k](/packages/karmendra-laravel-agent-detector)[eprofos/user-agent-analyzer

A powerful Symfony bundle for user-agent analysis. It provides accurate detection of operating systems (Windows, MacOS, Linux, iOS, Android...), browsers (Chrome, Firefox, Safari...), and device types (Desktop, Mobile, Tablet, TV...). Supports specific version detection and includes advanced handling of special cases like WebViews and compatibility modes. Features comprehensive logging and detailed analysis results.

182.3k](/packages/eprofos-user-agent-analyzer)

PHPackages © 2026

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