PHP code example of mimmi20 / browser-detector

1. Go to this page and download the library: Download mimmi20/browser-detector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mimmi20 / browser-detector example snippets


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

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

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

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

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

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

[
    '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,
    ],
]