PHPackages                             nmdimas/yii2-user-agent-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. nmdimas/yii2-user-agent-parser

ActiveYii2-extension[Parsing &amp; Serialization](/categories/parsing)

nmdimas/yii2-user-agent-parser
==============================

The user agent parser for the Yii framework (Yii2)

1.0(10y ago)95.1k↓87.5%3[1 issues](https://github.com/nmdimas/yii2-user-agent-parser/issues)[2 PRs](https://github.com/nmdimas/yii2-user-agent-parser/pulls)BSD-3-ClausePHP

Since Jul 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nmdimas/yii2-user-agent-parser)[ Packagist](https://packagist.org/packages/nmdimas/yii2-user-agent-parser)[ RSS](/packages/nmdimas-yii2-user-agent-parser/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Yii2 extension for user agent parser
====================================

[](#yii2-extension-for-user-agent-parser)

[![Build Status](https://camo.githubusercontent.com/14ce71dba737d6b497d3cfc3d6d894647731407a8e40e61ac827bf45728d2310/68747470733a2f2f7472617669732d63692e6f72672f6e6d64696d61732f796969322d757365722d6167656e742d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nmdimas/yii2-user-agent-parser)[![HHVM Status](https://camo.githubusercontent.com/0123c04b1ca30cd32d7062c96b46b591ec106a598533d5e3db265413a1591dba/687474703a2f2f6868766d2e683463632e64652f62616467652f6e6d64696d61732f796969322d757365722d6167656e742d7061727365722e737667)](http://hhvm.h4cc.de/package/nmdimas/yii2-user-agent-parser)

This extension adds support for PhpUserAgent() to the Yii2 framework.

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

[](#installation)

```
'components' => [
      ...
      'userAgentParser' => [
          'class' => 'yii\useragentparser\UserAgentParser',
          'nameHttpPropertyUserAgent' => 'HTTP_USER_AGENT'
      ],
      ...
  ],
```

Usage
-----

[](#usage)

If we parse current request

```
$userAgentInfo = Yii::$app->userAgentParser->getUserAgentObject();
```

or need parse isset user-agent

```
$userAgentInfo = Yii::$app->userAgentParser->getUserAgentObject($userAgent);
```

$userAgentInfo it's UserAgentObject with properties:

- userAgent
- platform
- browser
- version

Best practices
--------------

[](#best-practices)

Add to Yii.php in root for autocompletion for custom components.

```
 /** @property  \yii\useragentparser\UserAgentParser $userAgentParser */
```

About autocompletion for custom components.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

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

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3999d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05c104f15c8f3b190238c86dfa5afa6076ed25101e73252cd11c53b98f9f0fa2?d=identicon)[NmDimas](/maintainers/NmDimas)

---

Top Contributors

[![nmdimas](https://avatars.githubusercontent.com/u/1581090?v=4)](https://github.com/nmdimas "nmdimas (11 commits)")[![squirrelm](https://avatars.githubusercontent.com/u/9818171?v=4)](https://github.com/squirrelm "squirrelm (1 commits)")

---

Tags

parseruser agentyii2uaparser

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nmdimas-yii2-user-agent-parser/health.svg)

```
[![Health](https://phpackages.com/badges/nmdimas-yii2-user-agent-parser/health.svg)](https://phpackages.com/packages/nmdimas-yii2-user-agent-parser)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[donatj/phpuseragentparser

Lightning fast, minimalist PHP UserAgent string parser.

60417.7M72](/packages/donatj-phpuseragentparser)[thadafinser/user-agent-parser

UserAgent parsing done right http://useragent.mkf.solutions/

246317.3k2](/packages/thadafinser-user-agent-parser)[dmstr/yii2-json-editor

Yii2 wrapper for "json-editor/json-editor" (is a fork of "jdorn/json-editor")

1064.7k6](/packages/dmstr-yii2-json-editor)[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.

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

PHPackages © 2026

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