Elao/ElaoBrowserDetectorBundle

Name: ElaoBrowserDetectorBundle

Owner: Elao

Description: null

Created: 2013-06-27 11:52:43.0

Updated: 2017-06-05 23:29:15.0

Pushed: 2015-11-03 10:24:02.0

Homepage: null

Size: 271

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Elao BrowserDetector Bundle

Deprecated : please use https://github.com/piwik/device-detector instead.
Changelog
Installation:

Require the bundle via composer:

"require": {
    "elao/browser-detector-bundle": "1.1.*"
}

Add the bundle to your AppKernel.php:

new Elao\Bundle\BrowserDetectorBundle\ElaoBrowserDetectorBundle()
Configuration:

Register the browsers that are not and/or partially supported by your application:

elao_browser_detector:
    browsers:
        partially_compatible:
            "Internet Explorer": "<9"
            "Opera": ~
        incompatible:
            "IE": "<=7"

Accepted version format:

How it works:
Usage:
The BrowserDetector service

Get the BrowserDetector service or have it injected in your service: elao.browser_detector

$browserDetector = $container->get('elao_browser_detector');
// or
<argument type="service" id="elao_browser_detector" />

You're now able to get some compatibility information from the BrowserDetector service:

// Compatibility issers :
$browserDetector->isCompatible();
$browserDetector->isPartiallyCompatible();
$browserDetector->isIncompatible();
Accessing the current Browser instance

If needed, you can work with the Browser object that provide a various set of helpers methods:

// Get the current Browser instance:
$browser = $browserDetector->getBrowser();

// Get the Name of the browser, ex: 'Firefox'
$browser->getName();

// Get the Version of the browser, ex: '22.0'
$browser->getVersion();

// Get the platform of the browser, ex: 'MacOsX'
$browser->getPlatform();

// Compatibility issers:
is(string $name, int $version = null)
isPlatform(string $platform)
isExactly(int $version)
isLaterThan(int $version)
isEqualOrLaterThan(int $version)
isEarlierThan(int $version)
isEqualOrEarlierThan(int $version)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.