Back to Blog
Dotkernel

WURFL Zend Framework Integration into DotKernel

WURFL is integrated into DotKernel, using the Zend_Http_UserAgent class from the latest release ZF 1.11.0rc1 ( Beta release at the date of this post). The integration of WURFL into DotKernel is described below. Download WURFL PHP API and unzip it into folder wurfl-php-1.1
  • Create folders and make it writable by web server
    • cache\wurfl\FILE_CACHE_PROVIDER
    • cache\wurfl\FILE_PERSISTENCE_PROVIDER
  • In folder configs:
    • Copy wurfl-config.xml from wurfl-php-1.1\examples\resources
    • Rename wurfl-config.xml to wurfl.xml
  • Edit configs\application.ini file; add these lines:
>resources.useragent.wurflapi.wurfl_api_version = "1.1"
resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/library/Wurfl/"
resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl.xml"
  • Create folder externals\wurfl, and copy the following files from:
    • wurfl-php-1.1\examples\resources\web_browsers_patch.xml
    • wurfl-php-1.1\examples\resources\wurfl-regression.zip and rename it wurfl.zip or download the latest wurfl zip database and rename it wurfl.zip
  • Copy the contents of the folder wurfl-php-1.1\WURFL to library\Wurfl
WURFL is integrated into DotKernel in the mobile module, but to access WURFL configuration, use
>$userAgent = new Zend_Http_UserAgent($config->resources->useragent);
$device = $userAgent->getDevice();
$userAgent->getDevice() returns all the relevant information about the current user agent ($_SERVER)