Identifies the platform, browser, robot, or mobile device from the user agent string

This class uses PHP's get_browser() to get details from the browsers user agent string. If not available, it can use a coded alternative using the php_browscap.ini file from http://browsers.garykeith.com.

package Fuel
subpackage Core
category Core
author Harro Verton

 Methods

map the user agent string to browser specifications

_init() : void

check if the current browser accepts a specific character set

accepts_charset(string $charset) : bool

Parameters

$charset

string

optional character set, defaults to 'utf-8'

Returns

bool

check if the current browser accepts a specific language

accepts_language(string $language) : bool

Parameters

$language

string

optional ISO language code, defaults to 'en'

Returns

bool

get the normalized browser name

browser() : string

Returns

string

get the list of browser accepted charactersets

charsets() : array

Returns

array

check if the current browser is mobile device

is_mobiledevice() : bool

Returns

bool

check if the current browser is a robot or crawler

is_robot() : bool

Returns

bool

get the list of browser accepted languages

languages() : array

Returns

array

Get the browser platform

platform() : string

Returns

string

Get all browser properties

properties() : array

Returns

array

Get any browser property

property(string $property) : string | null

Parameters

$property

string

Returns

stringnull

Get the Browser Version

version() : string

Returns

string

use the parsed php_browscap.ini file to find a user agent match

get_from_browscap() : mixed

Returns

mixedarray if a match is found, of false if not cached yet

download and parse the browscap file

parse_browscap() : array

Exceptions

\Exception
\FuelException

Returns

arrayarray with parsed download info, or empty if the download is disabled of failed

 Properties

 

<p>global config items</p>

$config : array

 

<p>global config defaults</p>

$defaults : array

 

<p>property to cache key mapping</p>

$keys : array

 

<p>information about the current browser</p>

$properties : array

 

<p>detected user agent string</p>

$user_agent : string