PHPackages                             wpbones/useragent - 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. wpbones/useragent

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

wpbones/useragent
=================

An useful method to detect the useragent

1.1.1(1y ago)0601MITPHP

Since Jan 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/wpbones/useragent)[ Packagist](https://packagist.org/packages/wpbones/useragent)[ Docs](https://github.com/wpbones/useragent)[ RSS](/packages/wpbones-useragent/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (8)Used By (0)

User Agent for WP Bones
=======================

[](#user-agent-for-wp-bones)

[![Latest Stable Version](https://camo.githubusercontent.com/268000a1501104cb2e8c5a0c690ed5203d5f352d8cc7d5d09f495cd0051580c2/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f757365726167656e742f762f737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/useragent) [![Latest Unstable Version](https://camo.githubusercontent.com/1388d33ea31ddf2b4a7b9930c14efca5d28c739469dc9f22f99b56248cd784a1/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f757365726167656e742f762f756e737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/useragent) [![Total Downloads](https://camo.githubusercontent.com/a2fcd1fe15ee7ad3db32bd6bce9756011f9f774ec0a6c0010747a39c31a801b9/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f757365726167656e742f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/useragent) [![License](https://camo.githubusercontent.com/b64343845d76ab6aeda467152b58bc9ee4bd54b5f42e2f00b87f7f813f1c6cd6/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f757365726167656e742f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/useragent) [![Monthly Downloads](https://camo.githubusercontent.com/e39f17c59aa68999c30286a525e45d6fc4d0f83b45dc26e3ecf1eb2aea52492b/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f757365726167656e742f642f6d6f6e74686c793f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/useragent)

An useful wrapper for [Mobile Detect](https://github.com/serbanghita/Mobile-Detect) to detect mobile devices for WP Bones.

Requirements
------------

[](#requirements)

This package works with a WordPress plugin written with [WP Bones framework library](https://github.com/wpbones/WPBones).

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

[](#installation)

You can install third party packages by using:

```
php bones require wpbones/useragent
```

I advise to use this command instead of `composer require` because doing this an automatic renaming will done.

You can use composer to install this package:

```
composer require wpbones/useragent
```

You may also to add `"wpbones/useragent": "^1.0"` in the `composer.json` file of your plugin:

```
  "require": {
    "php": ">=7.4",
    "wpbones/wpbones": "~0.8",
    "wpbones/useragent": "~1.0"
  },
```

and run

```
composer install
```

How to
------

[](#how-to)

You will be able to use `wpbones_user_agent()` function to get an instance of Mobile Detect.

```
if(wpbones_user_agent()->isMobile()) {
  echo "You're by Mobile";
} else {
  echo "You're by Desktop";
}
```

### Sample

[](#sample)

```
// Basic detection.
wpbones_user_agent()->isMobile();
wpbones_user_agent()->isTablet();

// Magic methods.
wpbones_user_agent()->isIphone();
wpbones_user_agent()->isSamsung();
// [...]

// Alternative to magic methods.
wpbones_user_agent()->is('iphone');

// Find the version of component.
wpbones_user_agent()->version('Android');
```

You may also

```
// Any mobile device (phones or tablets).
if ( wpbones_user_agent()->isMobile() ) {

}

// Any tablet device.
if( wpbones_user_agent()->isTablet() ){

}

// Exclude tablets.
if( wpbones_user_agent()->isMobile() && !wpbones_user_agent()->isTablet() ){

}

// Check for a specific platform with the help of the magic methods:
if( wpbones_user_agent()->isiOS() ){

}

if( wpbones_user_agent()->isAndroidOS() ){

}

// Alternative method is() for checking specific properties.
// WARNING: this method is in BETA, some keyword properties will change in the future.
wpbones_user_agent()->is('Chrome')
wpbones_user_agent()->is('iOS')
wpbones_user_agent()->is('UCBrowser')
wpbones_user_agent()->is('Opera')
// [...]
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance46

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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 ~460 days

Recently: every ~575 days

Total

6

Last Release

409d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3eb65ad928faf1a3303497a2f9e3bb8db51ebcb09dc21c6ddc3546b4bdc9c2b4?d=identicon)[gfazioli](/maintainers/gfazioli)

---

Top Contributors

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

---

Tags

user agentWP Bones

### Embed Badge

![Health badge](/badges/wpbones-useragent/health.svg)

```
[![Health](https://phpackages.com/badges/wpbones-useragent/health.svg)](https://phpackages.com/packages/wpbones-useragent)
```

###  Alternatives

[jenssegers/agent

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

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

Browser &amp; Mobile detection package for Laravel.

1.1k10.9M61](/packages/hisorange-browser-detect)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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