PHPackages                             mimmi20/browser-detector - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mimmi20/browser-detector

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mimmi20/browser-detector
========================

Library to detect Browsers and Devices

10.0.34(1mo ago)48153.5k↑191.7%11[4 PRs](https://github.com/mimmi20/browser-detector/pulls)3MITPHPPHP ~8.4.0 || ~8.5.0 || ~8.6.0CI passing

Since Jan 25Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/mimmi20/browser-detector)[ Packagist](https://packagist.org/packages/mimmi20/browser-detector)[ Docs](https://github.com/mimmi20/BrowserDetector)[ RSS](/packages/mimmi20-browser-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (76)Versions (212)Used By (3)

BrowserDetector
===============

[](#browserdetector)

[![Latest Stable Version](https://camo.githubusercontent.com/05c89df6c7d04ea898fc8422ba37c5cc03f4af975a541c3d1d01686117597118/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f62726f777365722d6465746563746f722f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/browser-detector)[![Latest Unstable Version](https://camo.githubusercontent.com/38afa14b49a13c27fda23a148a042dd68231c0970d31729ff00167dc14dc8d78/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f62726f777365722d6465746563746f722f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/browser-detector)[![License](https://camo.githubusercontent.com/a661a515d9455cc1fede15868c4170a2d5fad8c38090d8bb8f1026e28f913b87/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f62726f777365722d6465746563746f722f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/browser-detector)

Code Status
-----------

[](#code-status)

[![codecov](https://camo.githubusercontent.com/42da74b6eff6df5f8fd18fbceba67901c6231ab6c36875d17114216713fb74c7/68747470733a2f2f636f6465636f762e696f2f67682f6d696d6d6932302f42726f777365724465746563746f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/mimmi20/BrowserDetector)[![Test Coverage](https://camo.githubusercontent.com/4d5b8dd7147b91dc0823973ff1da0d1d6d03109f60519c26f9b130941717f8d6/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65333130613739373764366133373563396464372f746573745f636f766572616765)](https://codeclimate.com/github/mimmi20/browser-detector/test_coverage)[![Average time to resolve an issue](https://camo.githubusercontent.com/747be777ad0a52308521388723bc78270922eebd391e3e2895e24d9a74d7ddb9/68747470733a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f6d696d6d6932302f42726f777365724465746563746f722e737667)](https://isitmaintained.com/project/mimmi20/BrowserDetector "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/4c2ba519e9ac10d3c6a5a796695eaafef41bbb15ca3daf0b6423d36219f9553b/68747470733a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f6d696d6d6932302f42726f777365724465746563746f722e737667)](https://isitmaintained.com/project/mimmi20/BrowserDetector "Percentage of issues still open")[![Mutation testing badge](https://camo.githubusercontent.com/f18c00dbb73ce293b9f5dd8330b590600540766182b6ec99457fd4d85b495ba3/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532466d696d6d69323025324662726f777365722d6465746563746f722532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/mimmi20/browser-detector/master)[![Maintainability](https://camo.githubusercontent.com/6d2957f3c598af9273f13d958c371d0bf6c19c7c468a9ecf686863d8365d79bd/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65333130613739373764366133373563396464372f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/mimmi20/browser-detector/maintainability)

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

[](#requirements)

This library requires PHP 8.3+. Also a PSR-3 compatible logger and a PSR-16 compatible cache are required.

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

[](#installation)

Run the command below to install via Composer

```
composer require mimmi20/browser-detector
```

Usage
-----

[](#usage)

```
$detectorFactory = new \BrowserDetector\DetectorFactory($cache, $logger);
$detector        = $detectorFactory();

// get the result
$result = $detector->getBrowser($request);
```

The request parameter may be a string, an array or a PSR-7 compatible message.

Usage Examples
--------------

[](#usage-examples)

### Taking the user agent from the global $\_SERVER variable

[](#taking-the-user-agent-from-the-global-_server-variable)

```
$detectorFactory = new \BrowserDetector\DetectorFactory($cache, $logger);
$detector        = $detectorFactory();

$result = $detector->getBrowser($_SERVER);
```

### Using a sample useragent

[](#using-a-sample-useragent)

```
$detectorFactory = new \BrowserDetector\DetectorFactory($cache, $logger);
$detector        = $detectorFactory();

$result = $detector->getBrowser($the_user_agent);
```

The result
----------

[](#the-result)

The `getBrowser` function returns an array with this structure

```
[
    'headers' => [],
    'device' => [
        'architecture' => null,
        'deviceName' => null,
        'marketingName' => null,
        'manufacturer' => 'unknown',
        'brand' => 'unknown',
        'dualOrientation' => null,
        'simCount' => null,
        'display' => [
            'width' => null,
            'height' => null,
            'touch' => null,
            'size' => null,
        ],
        'type' => 'unknown',
        'ismobile' => null,
        'istv' => null,
        'bits' => null,
    ],
    'os' => [
        'name' => null,
        'marketingName' => null,
        'version' => null,
        'manufacturer' => 'unknown',
    ],
    'client' => [
        'name' => null,
        'modus' => null,
        'version' => null,
        'manufacturer' => 'unknown',
        'type' => 'unknown',
        'isbot' => null,
    ],
    'engine' => [
        'name' => null,
        'version' => null,
        'manufacturer' => 'unknown',
    ],
]
```

Issues and feature requests
---------------------------

[](#issues-and-feature-requests)

Please report your issues and ask for new features on the GitHub Issue Tracker at

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance89

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity100

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.1% 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 ~19 days

Recently: every ~7 days

Total

210

Last Release

56d ago

Major Versions

5.0.85 → 6.0.02021-03-09

6.0.7 → 7.0.02021-12-19

7.0.3 → 8.0.02023-10-29

8.1.0 → 9.0.02024-11-16

9.0.5 → 10.0.02025-01-22

PHP version history (14 changes)0.1.0-alphaPHP &gt;=5.4.0

0.2.0-betaPHP ^5.6 || ^7.0 || ^7.1

1.0.0PHP ^7.0

2.0.0PHP ^7.1

5.0.34PHP ^7.1.3

5.0.56PHP ^7.1.3 || ^8.0.0

6.0.0PHP ^7.4.0 || ^8.0.0

6.0.3PHP ^7.4.3 || ^8.0.0

7.0.3PHP ^8.1.0

8.0.3PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

8.1.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

9.0.0PHP ~8.3.0 || ~8.4.0 || ~8.5.0

10.0.4PHP ~8.4.0 || ~8.5.0

10.0.27PHP ~8.4.0 || ~8.5.0 || ~8.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fea77dd303122241a6caac15ea7456607bcb6f5db869fc8fc9eaf3ec0630a84?d=identicon)[mimmi20](/maintainers/mimmi20)

---

Top Contributors

[![mimmi20](https://avatars.githubusercontent.com/u/1120192?v=4)](https://github.com/mimmi20 "mimmi20 (5946 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (458 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (42 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (6 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (4 commits)")[![hross](https://avatars.githubusercontent.com/u/166143?v=4)](https://github.com/hross "hross (2 commits)")

---

Tags

detectphpphp84ua-parseruser-agentuser-agent-parserhttpbrowserparseruser agent

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mimmi20-browser-detector/health.svg)

```
[![Health](https://phpackages.com/badges/mimmi20-browser-detector/health.svg)](https://phpackages.com/packages/mimmi20-browser-detector)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[laminas/laminas-psr7bridge

Bidirectional conversions between PSR-7 and laminas-http messages

117.9M18](/packages/laminas-laminas-psr7bridge)[sunrise/http-router

A powerful solution as the foundation of your project.

16249.8k10](/packages/sunrise-http-router)

PHPackages © 2026

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