mimmi20 / browser-detector
Library to detect Browsers and Devices
8.0.5
2024-10-08 12:37 UTC
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
- ext-json: *
- ext-mbstring: *
- laminas/laminas-diactoros: ^3.3.1
- mimmi20/browser-detector-version: ^9.0.8
- mimmi20/ios-build: ^3.0.8
- mimmi20/macos-build: ^3.0.7
- mimmi20/ua-browser-type: ^9.0.7
- mimmi20/ua-device-type: ^9.0.7
- mimmi20/ua-normalizer: ^6.0.8
- psr/http-message: ^2.0
- psr/log: ^3.0.0
- psr/simple-cache: ^3.0.0
Requires (Dev)
- ext-ctype: *
- ext-dom: *
- ext-intl: *
- ext-simplexml: *
- ext-tokenizer: *
- ext-xml: *
- ext-xmlwriter: *
- infection/infection: ^0.27.11 || ^0.28.1 || ^0.29.0
- mikey179/vfsstream: ^1.6.12
- mimmi20/coding-standard: ^5.2.44
- nikic/php-parser: ^4.19.1 || ^5.0.2
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^1.12.5
- phpstan/phpstan-deprecation-rules: ^1.2.1
- phpstan/phpstan-phpunit: ^1.4.0
- phpunit/phpunit: ^10.5.25
- rector/rector: ^1.2.5
- rector/type-perfect: ^1.0.0
- symplify/phpstan-rules: ^13.0.1
- tomasvotruba/cognitive-complexity: ^0.2.3
- tomasvotruba/type-coverage: ^1.0.0
- tomasvotruba/unused-public: ^1.0.0
- dev-master
- 8.0.5
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0.0
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.7
- 6.0.6
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.85
- 5.0.84
- 5.0.83
- 5.0.82
- 5.0.81
- 5.0.80
- 5.0.79
- 5.0.78
- 5.0.77
- 5.0.76
- 5.0.75
- 5.0.74
- 5.0.73
- 5.0.72
- 5.0.71
- 5.0.70
- 5.0.69
- 5.0.68
- 5.0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.1
- 1.0.0
- 0.2.0-beta
- 0.1.0-alpha
- dev-dependabot/composer/master/version-updates-daf347c6ac
- dev-updates
This package is auto-updated.
Last update: 2024-11-06 05:33:05 UTC
README
Code Status
Requirements
This library requires PHP 8.1+. 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' => null, 'brand' => null, 'dualOrientation' => null, 'simCount' => null, 'display' => [ 'width' => null, 'height' => null, 'touch' => null, 'size' => null, ], 'type' => null, 'ismobile' => null, 'istv' => null, 'bits' => null, ], 'os' => [ 'name' => null, 'marketingName' => null, 'version' => null, 'manufacturer' => null, ], 'client' => [ 'name' => null, 'modus' => null, 'version' => null, 'manufacturer' => null, 'type' => null, 'isbot' => null, ], 'engine' => [ 'name' => null, 'version' => null, 'manufacturer' => null, ], ]
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