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

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

hugsbrugs/php-useragent
=======================

PHP User Agent Utilities

112[1 PRs](https://github.com/hugsbrugs/php-useragent/pulls)PHP

Since Apr 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hugsbrugs/php-useragent)[ Packagist](https://packagist.org/packages/hugsbrugs/php-useragent)[ RSS](/packages/hugsbrugs-php-useragent/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-useragent
=============

[](#php-useragent)

This librairy provides utilities function to get usergent informations from different methods

[![Build Status](https://camo.githubusercontent.com/d0a33075ba975578af5511172470399402d2d9d8cb2eafd8a2ed9792e2ea01ca/68747470733a2f2f7472617669732d63692e6f72672f6875677362727567732f7068702d757365726167656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugsbrugs/php-useragent)[![Coverage Status](https://camo.githubusercontent.com/d0c0e68c69be1cb191d886e697acb8093926c9f04bb9e69336057bd1de0c6d71/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875677362727567732f7068702d757365726167656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hugsbrugs/php-useragent?branch=master)

Install
-------

[](#install)

Install package with composer

```
composer require hugsbrugs/php-useragent

```

In your PHP code, load library

```
require_once __DIR__ . '/../vendor/autoload.php';
use Hug\UserAgent\UserAgent as UserAgent;
```

Usage
-----

[](#usage)

Get browser infos from PHP [browscap](http://php.net/manual/en/function.get-browser.php) database (Need to be installed and configured)

```
$ua = UserAgent::get_browscap();
```

Get browser infos from regex
============================

[](#get-browser-infos-from-regex)

```
$ua2 = UserAgent::get_browser();
```

Get\_browser\_name (Possible values : Unknown Browser, Internet Explorer, Firefox, Safari, Chrome, Edge, Opera, Netscape, Maxthon, Konqueror, Handheld Browse)

```
$ua3 = UserAgent::get_browser_name();
```

Get OS from list of most common OS (Possible Values : Unknown OS Platform, Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista, Windows Server 2003/XP x64, Windows XP, Windows XP, Windows 2000, Windows ME, Windows 98, Windows 95, Windows 3.11, Mac OS X, Mac OS 9, Linux, Ubuntu, iPhone, iPod, iPad, Android, BlackBerry, Mobil)

```
$os = UserAgent::get_os($ua = null);
```

Unit Tests
----------

[](#unit-tests)

```
phpunit --bootstrap vendor/autoload.php tests

```

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

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://www.gravatar.com/avatar/cc04033020c3e5219ac30edf7d7362952e88ea64a0de2f41b89559f849f09901?d=identicon)[hugsbrugs](/maintainers/hugsbrugs)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[emreyarligan/enum-concern

A PHP package for effortless Enumeration handling with Laravel Collections 📦 ✨

21156.3k1](/packages/emreyarligan-enum-concern)[graze/supervisor

:vertical\_traffic\_light: Process supervisor for PHP.

999.3k](/packages/graze-supervisor)[burnbright/silverstripe-hasonefield

Edit a has\_one relationship using a GridField, triggered by clicking a button.

3439.9k1](/packages/burnbright-silverstripe-hasonefield)[joegreen0991/hyperloglog

A hyper log log with min hash data structure library, for counting cardinalities. Union and intersection capable

2116.5k](/packages/joegreen0991-hyperloglog)[arbermustafa/filament-google-charts-widgets

Chart widgets for Filament Php using Google Charts

147.4k](/packages/arbermustafa-filament-google-charts-widgets)

PHPackages © 2026

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