This package is abandoned and no longer maintained. The author suggests using the piwik/device-detector package instead.

Elao Browser Detector Bundle

Installs: 2 207

Dependents: 0

Suggesters: 0

Security: 0

Stars: 15

Watchers: 22

Forks: 5

Open Issues: 0


1.1.2 2015-01-23 16:26 UTC

This package is not auto-updated.

Last update: 2019-02-20 17:30:12 UTC


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


  • 1.1.0
    • BrowserCap and Browser ar now in a separate ElaoBrowserDetector component
    • Rename some parameters
    • Fix composer


Require the bundle via composer:

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

Add the bundle to your AppKernel.php:

new Elao\Bundle\BrowserDetectorBundle\ElaoBrowserDetectorBundle()


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

        	"Internet Explorer": "<9"
       		"Opera": ~
       		"IE": "<=7"

Accepted version format:

  • none : any version number, ex: "Firefox": ~ (any Firefox version will match)
  • 'n' : exact version number, ex: "Firefox": '3.6' (only Firefox 3.6 will match)
  • '>n' : strictly later, ex: "Firefox": '>3.6' (Firefox 3.6 will not match, Firefox 3.7 will)
  • '<n' : strictly earlier, ex: "Firefox": '<3.6' (Firefox 3.6 will not match, Firefox 3.5 will)
  • '>=n' : equal or later version, ex: "Firefox": '>=3.6' (Firefox 3.6 and 3.7 will match)
  • '<=n' : equal or earlier version, ex: "Firefox": '<=3.6' (Firefox 3.6 and 3.5 will match)

How it works:

  • The bundle listen to the kernel.request event.
  • It gets the user-agent http header directive from the request on each master request.
  • It use the php get_browser function (based on the browscap.ini file) to detect wich browser is used.
  • It instantiate an Elao\BrowserDetector\Browser object that will resolve compatibility of the current browser based your configuration.


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 :

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'

// Get the Version of the browser, ex: '22.0'

// Get the platform of the browser, ex: 'MacOsX'

// 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)