mimmi20 / browser-detector
Library to detect Browsers and Devices
11.0.8
2026-06-01 21:11 UTC
Requires
- php: ~8.5.0 || ~8.6.0
- ext-json: *
- ext-mbstring: *
- laminas/laminas-diactoros: ^3.8.0
- laminas/laminas-hydrator: ^4.19.0
- laminas/laminas-json: ^3.8.0
- laminas/laminas-serializer: ^3.3.0
- mimmi20/browser-detector-version: ^14.0.0
- mimmi20/browser-detector-versioninterface: ^2.0.0
- mimmi20/ios-build: ^6.0.0
- mimmi20/macos-build: ^6.0.0
- mimmi20/ua-browser-type: ^13.0.1
- mimmi20/ua-data-interface: ^2.0.0
- mimmi20/ua-device-type: ^13.0.0
- mimmi20/ua-generic-request: ^18.0.4
- mimmi20/ua-loader-interface: ^7.0.1
- mimmi20/ua-normalizer: ^9.0.9
- mimmi20/ua-parser-interface: ^7.0.1
- mimmi20/ua-result: ^16.0.2
- psr/http-message: ^1.1 || ^2.0
- psr/log: ^3.0.2
- psr/simple-cache: ^3.0.0
- symfony/polyfill-php85: ^1.37.0
Requires (Dev)
- ext-ctype: *
- ext-dom: *
- ext-intl: *
- ext-simplexml: *
- ext-tokenizer: *
- ext-xml: *
- ext-xmlwriter: *
- ergebnis/composer-normalize: ^2.52.0
- infection/infection: ^0.33.2
- jbelien/phpstan-sarif-formatter: ^1.2.0
- mikey179/vfsstream: ^1.6.12
- mimmi20/coding-standard: ^8.0.2
- nikic/php-parser: ^5.7.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1.55
- phpstan/phpstan-deprecation-rules: ^2.0.4
- phpunit/phpunit: ^13.1.11
- rector/rector: ^2.4.4
- rector/type-perfect: ^2.1.4
- shipmonk/composer-dependency-analyser: ^1.8.4
- symfony/process: ^8.0.11
- symplify/phpstan-extensions: ^12.0.2
- symplify/phpstan-rules: ^14.9.11
- tomasvotruba/cognitive-complexity: ^1.1.0
- tomasvotruba/type-coverage: ^2.1.0
- tomasvotruba/unused-public: ^2.2.0
This package is auto-updated.
Last update: 2026-06-19 18:29:56 UTC
README
Code Status
Requirements
This library requires PHP 8.3+. Also a PSR-3 compatible logger and a PSR-16 compatible cache are required.
Installation
Run the command below to install via Composer
composer require mimmi20/browser-detector
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
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
$detectorFactory = new \BrowserDetector\DetectorFactory($cache, $logger); $detector = $detectorFactory(); $result = $detector->getBrowser($the_user_agent);
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
Please report your issues and ask for new features on the GitHub Issue Tracker at https://github.com/mimmi20/BrowserDetector/issues