This post refers to DotKernel 1, based on Zend Framework 1.
If you are looking for DotKernel 3 related posts, go here.

The new DotKernel version 1.6.0 is comming with some changes how we are detecting mobile devices, this changes are because of the new Wurfl Cloud integration.

This version of DotKernel is not comming anymore with a working built in method for mobile detection, so first we have to configure it.

  • go to scientiamobile website and register for an Wurfl Cloud account
  • choose device_os and mobile_browser to your account and save
  • go to API Keys and copy the right key in application.ini


We choosed device_os and mobile_browser capabilities because with these two capabilities we can get some extra capabilities (isMobile, isSmartPhone, isIphone, isAndroid, isBlackberry, is Symbian and is WindowsMobile) using our built in methods.

Choosing other capabilities from scientiamobile will result in wrong detection of these extra capabilities, but you can get only those capabilities using another method from Dot_UserAgent_WurflCloud class.

Wurfl Cloud setting in application.ini = TRUE
resources.useragent.wurflcloud.redirect = TRUE
resources.useragent.wurflcloud.cache = TRUE
resources.useragent.wurflcloud.cache_lifetime = 3600
resources.useragent.wurflcloud.cache_namespace = WURFLCLOUD
resources.useragent.wurflcloud.api_key = 000000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
resources.useragent.wurflcloud.lib_dir = APPLICATION_PATH "/library/WurflCloud/"

active – used to turn on (TRUE) or off (FALSE) the wurfl cloud detection (default: TRUE)
redirect – if is TRUE your visitators from frontend will be redirected to mobile module (default: TRUE)
cache – cache every distinct result to optimize the number of requests to scientiamobile (default: TRUE)
cache_lifetime – time in seconds to keep the results in cache (default: 3600)
cache_namespace – the prefix used for cache keys (default: WURFLCLOUD)
api_key – API Key from WURFL Cloud account (change this with your key)
lib_dir – the wurfl cloud library location in DotKernel (don’t change this, just if you want to move the library)

Because of these changes we removed the old Dot_UserAgent_Wurfl class and added the new one Dot_UserAgent_WurflCloud wich is using the Wurfl Cloud API adapter.

Example of Dot_UserAgent usage in DotKernel:

Get Wurfl configuration

$wurflConf = $registry->configuration->resources->useragent->wurflcloud;

Note: You can have more Wurfl configurations if you have more libraries like Wurfl Package (GPL)

If Wurfl is active then get device info

	$deviceInfo = Dot_UserAgent :: getDeviceInfo($_SERVER);

If detected device is an mobile device we will save device info in database and redirect it to the mobile controller

if( (0 < count((array)$deviceInfo)) && $deviceInfo->isMobile)
		$registry->session->visitId = Dot_Statistic::registerVisit();
	// if the Statistic module is integrate, record the deviceInfo too, and record TRUE
        //in $session->mobile 
		$registry->session->mobile = 
                Dot_Statistic::registerMobileDetails($registry->session->visitId, $deviceInfo);
		//redirect to mobile controller , only if the session is not set. 
		//Otherwise will trap the user in mobile controller
			header('location: '.


  1. Wurfl Cloud Integration in DotKernel 1.6.0 | DotKernel PHP Application Framework

    […] To see how mobile detection is working in DotKernel read this post. […]

  2. Scientia Mobile licensed its Wurfl Cloud PHP library to DotKernel 1.6 | DotKernel PHP Application Framework

    […] Instructions about how to signup for a free account , and how to setup your API key can be found here . […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>