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

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

nxtcode/mobile-detect
=====================

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

0169PHP

Since Sep 1Pushed 4y agoCompare

[ Source](https://github.com/NxtCodeCom/Laravel-Mobile-Detect-Extended)[ Packagist](https://packagist.org/packages/nxtcode/mobile-detect)[ RSS](/packages/nxtcode-mobile-detect/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Service
=======

[](#service)

[![Latest Stable Version](https://camo.githubusercontent.com/8c39b9a5822d4153549aa976b0f999aee7faa4c7772b0af328f310ded3a2dd4a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e7874636f64652f6167656e742e737667)](https://packagist.org/packages/nxtcode/agent) [![Total Downloads](https://camo.githubusercontent.com/f6ade282b9bf9fec45b8b10c3893dc36ed93783e9dbf82a51087070d10aec2f8/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e7874636f64652f6167656e742e737667)](https://packagist.org/packages/nxtcode/agent) [![Build Status](https://camo.githubusercontent.com/4acf198bd6d3c47c1a63dfe384004ff605cbe56109ba1cacc6dd669f1f36cc88/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6e7874636f64652f6167656e742e737667)](https://travis-ci.org/nxtcode/agent) [![Coverage Status](https://camo.githubusercontent.com/0a4621878b87ce2da0b7cdb7ad24d216916ec2baff5e12632f39f75d7f61ee1e/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6e7874636f64652f6167656e742e737667)](https://coveralls.io/r/nxtcode/agent) [![Donate](https://camo.githubusercontent.com/d47cdb766a100070d38a702d9c7760ccc8052063484e1478a26bcd16680d33af/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d626c75652e737667)](https://www.paypal.me/nxtcode)

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.

[![](https://camo.githubusercontent.com/ffddeea170e898d340ae6d2f9e21881395bd95e6209642130bd841e47d8bbc9e/68747470733a2f2f7777772e6e7874636f64652e636f6d2f7765626173736574732f696d672f626568616e63652e706e67)](https://camo.githubusercontent.com/ffddeea170e898d340ae6d2f9e21881395bd95e6209642130bd841e47d8bbc9e/68747470733a2f2f7777772e6e7874636f64652e636f6d2f7765626173736574732f696d672f626568616e63652e706e67)

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

[](#installation)

Install using composer:

```
composer require nxtcode/agent
```

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

[](#laravel-optional)

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

```
NxtCode\Service\ServiceServiceProvider::class,
```

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

```
'Service' => NxtCode\Service\Facades\Service::class,
```

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

[](#basic-usage)

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

```
use NxtCode\Service\Service;

$tool = new Service();
```

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

```
$tool->setUserService('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');
$tool->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.

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

### Magic is-method

[](#magic-is-method)

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

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

### Mobile detection

[](#mobile-detection)

Check for mobile device:

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

### Match user agent

[](#match-user-agent)

Search the user agent with a regular expression:

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

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

[](#additional-functionality)

### Accept languages

[](#accept-languages)

Get the browser's accept languages. Example:

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

### Device name

[](#device-name)

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

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

### Operating system name

[](#operating-system-name)

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

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

### Browser name

[](#browser-name)

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

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

### Desktop detection

[](#desktop-detection)

Check if the user is using a desktop device.

```
$tool->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.

```
$tool->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.

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

### Robot name

[](#robot-name)

Get the robot name.

```
$robot = $tool->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 = $tool->browser();
$version = $tool->version($browser);

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

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

License
-------

[](#license)

Laravel User Service 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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/89665607?v=4)[Vinay Choudhary](/maintainers/MadCrypt)[@MadCrypt](https://github.com/MadCrypt)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[highwire/better-dom-document

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

1526.3k](/packages/highwire-better-dom-document)

PHPackages © 2026

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