Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Configuration Options

UserAgent Options

The following options may be passed to the constructor or within your application configuration. A "." indicates another layer of depth in the configuration array.

Each features adapter has its own options available as well, which may be mixed in with the general UserAgent options.


Used to seed the list of devices the component will search. See also identification_sequence; this value will be prepended to that list during user agent device discovery.


The value of the Accept HTTP header; used by some user agents to determine capabilities. Set this to seed the value explicitly.


A comma-separated list of device types to scan for matches; defaults to "mobile,desktop".


The name of a storage adapter used to persist the device capabilities, typically within a given user session. The value may either be a fully qualified class name, or a short name to resolve by the plugin loader for storage classes. By default, uses "Session" as the value, resolving to Zend_Http_UserAgent_Storage_Session.


An array of options to pass to the constructor of a storage adapter. By default, the option browser_type will be present.

plugin_loader.[type] = [class]

Plugin loader configuration; allows you to specify a pre-configured Zend_Loader_PluginLoader extension class to use for one of the plugin loader types managed by UserAgent (currently "storage" and "device".


Typically, you will not set this; this simply allows injection of the $_SERVER superglobal (or a filtered version of it). The value should be an associative array.


The actual HTTP User-Agent string you wish to try and match. Typically, this will be auto-discovered from the server array.


The device class to use for a given browser type; typically, browser_type will be one of the supported browser devices, including:

  • Bot

  • Checker

  • Console

  • Desktop

  • Email

  • Feed

  • Mobile

  • Offline

  • Probe

  • Spam

  • Text

  • Validator

The browser_type should be normalized to lowercase for configuration purposes.

[browser_type].device.path and [browser_type].device.prefix

An alternate way to specify the device class for a given browser type is to assume it is named after the device, and that all device classes are in the same path sharing the same prefix. Configure the prefix and path using these keys.

As an example, the following would look for a class named "Mobile_Device_Bot" on the path "Mobile/Device/" under the application library. = APPLICATION_PATH '/../library/Mobile/Device" = "Mobile_Device"
[browser_type].features.path and [browser_type].features.classname

These settings are used to load the features capabilities detection class for a given browser type. The class will be named using the classname key, and is expected to exist in the file denoted by the path key. The class should implement Zend_Http_UserAgent_Features_Adapter.

Zend Framework