PHPackages                             cnwyt/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cnwyt/user-agent-parser

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

cnwyt/user-agent-parser
=======================

A Simple PHP Useragent Parser

0.6.0(7y ago)252MITPHPPHP &gt;=7.0CI failing

Since Sep 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cnwyt/UserAgentParser)[ Packagist](https://packagist.org/packages/cnwyt/user-agent-parser)[ RSS](/packages/cnwyt-user-agent-parser/feed)WikiDiscussions master Synced 2mo ago

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

*UserAgentParser*

A Simple PHP User Agent Parser

### Install

[](#install)

Packagist [cnwyt/user-agent-parser](https://packagist.org/packages/cnwyt/user-agent-parser)

```
$ composer require cnwyt/user-agent-parser
```

### Usage

[](#usage)

```
use Cnwyt\UserAgentParser\UserAgentParser;

// 获取 UserAgent
// $ua = $request->get('ua');
$ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:81.0) Gecko/20100101 Firefox/81.0';

// 实例化 UserAgentParser
$agent = (new UserAgentParser());

// 设置 UserAgent
$agent->setUserAgent($ua);

// 获取解析结果
$device = $agent->getDeviceName();

$browerName = $agent->getBrowserName();
$browerVersion = $agent->getBrowserVersion();

$systemName = $agent->getSystemName();
$systemVersion = $agent->getSystemVersion();

// 检测
$isIos = $agent->isIOS();

$isAndroid = $agent->isAndroidOS();

$isWechat =  $agent->isWechatBrowser();
```

### market report

[](#market-report)

NetMarketShare (2020-09):

```
Chrome     69.94%
Edge       8.84%
Firefox    7.19%
InternetExplorer 3.88%
Safari     3.57%
QQ         2.35%
SogouExplorer 1.48%
Opera      0.97%
Yandex     0.79%
UC Browser 0.52%

```

Baidu report (2020):

Chrome &gt; UC &gt; 微信(wechat) &gt; IE &gt; QQ &gt; 百度(baidu) &gt; Safari &gt; 其他(others)

### Tests

[](#tests)

```
$ git clone https://github.com/cnwyt/UserAgentParser.git
$ cd UserAgentParser
$ composer install
$ ./vendor/bin/phpunit tests/
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.8% 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 ~6 days

Total

3

Last Release

2796d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5b845d78f66a4a203662c72dfcad5ca40a38ca0caa88e3600bd3c9815186d8f?d=identicon)[cnwyt](/maintainers/cnwyt)

---

Top Contributors

[![wangyongtao](https://avatars.githubusercontent.com/u/2005898?v=4)](https://github.com/wangyongtao "wangyongtao (17 commits)")[![cnwyt](https://avatars.githubusercontent.com/u/31981248?v=4)](https://github.com/cnwyt "cnwyt (7 commits)")

---

Tags

phpuser-agent-parser

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laracademy/generators

This package will generate a Laravel Model based on your database table itself, filling in the required fields automatically.

355346.4k4](/packages/laracademy-generators)[beyondcode/laravel-vouchers

Allow users to redeem vouchers that are bound to models..

70763.4k2](/packages/beyondcode-laravel-vouchers)[firegento/magesetup2

MageSetup provides the necessary configuration (system config, tax, agreements, etc. for a national market.

123328.5k1](/packages/firegento-magesetup2)[sixlive/nova-text-copy-field

Laravel Nova text field with click to copy support

70708.2k2](/packages/sixlive-nova-text-copy-field)[happyr/message-serializer

Serialize classes the good way.

80491.3k](/packages/happyr-message-serializer)[percymamedy/laravel-dev-booter

Boost your Laravel app by registering Prod services only on Prod.

35320.7k1](/packages/percymamedy-laravel-dev-booter)

PHPackages © 2026

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