The UserAgent Device Interface

The UserAgent Features Adapter

Overview

A variety of databases exist that define browser device features and capabilities. Zend_Http_UserAgent provides the ability to utilize the database of your choice via a features adapter interface.

The features adapter is passed a request array that contains the User-Agent string and any other relevant HTTP headers and environment pertinent to detecting the device in use. Additionally, if any adapter-specific configuration might be needed, an additional configuration array will be provided. The adapter must then return an array of device capabilities.

Quick Start

The adapter interface is quite simple, defining but the single static method getFromRequest().

  1. interface Zend_Http_UserAgent_Features_Adapter
  2. {
  3.     /**
  4.      * Retrieve the browser's features from a given request object ($_SERVER)
  5.      *
  6.      * @return array
  7.      */
  8.     public static function getFromRequest($request, array $config);
  9. }

Configuration Options

Options are defined on a per-adapter basis.

Available Methods

getFromRequest ( array $request, array $config )

Decompose the request in order to return an array of device capabilities.


The UserAgent Device Interface