A First Look at the New WURFL API for PHP

Posted in Mobile, PHP and Programming on Monday, the 20th of April, 2009.

Tagged: , and

About a month ago, the New WURFL API for PHP was officially released. While the code had been available in one form or another for some time, the official release coincided nicely with the early stages of a new project at work, so it seemed like an appropriate time to have a look at the API and see if it was something we wanted to use.

By way of a refresher, WURFL is a "Device Description Repository" - a huge open-source XML-based database of information regarding mobile handsets and their capabilities. I've discussed WURFL in the past, for example here. Prior to this release, the only practical method of querying WURFL in real time from PHP was via a library named Tera-WURFL, which I blogged about here. In fact, both WURFL and Tera-WURFL were covered in an article I wrote for php|architect magazine last year.

We've generally been very happy with Tera-WURFL, but it's always worth considering one's options, so what follows is an overview of my experiences with, and first impressions of the New WURFL API.


Posted by Ciaran McNulty on Tuesday, the 21st of April, 2009.

An interesting article! I guess the move to the API expecting all of $_SERVER leaves the door open to the improvements you're after.

I agree that it seems strange that they'd rely on users installing PEAR::Log separately. A better solution might be one of the following:

a) Just include the relevant components in the distribution - PEAR::Log is opensourced under the MIT licence.

b) Provide a PEAR channel for installing the package, I think you could then include the dependency on PEAR::Log and let the package manager deal with it.

c) Let the application detect if PEAR::Log is installed, and fail gracefully if not.

Any of which would be preferable to the current solution.

Posted by redwan on Thursday, the 23rd of July, 2009.

Nice article. I think I'll stick to Tera WURFL. However, last week when I updated Tera WURFL using the wurfl.xml I downloaded from sourceforge, I discovered that my mozilla firefox browser was being detected as a wireless device and an IE 6 user-agent was detected as a Black Berry handset. I was shocked, I quickly reversed it by installing the older version of Tera WURFL I was using earlier... any insights to this... ???

Posted by Simon Harris on Tuesday, the 28th of July, 2009.

That seems to be quite common behaviour, redwan. WURFL by itself is geared up specifically to identify mobile browsers, so it'll err on that side.

There is, however, a web browsers patch available form the WURFL site. I believe it comes bundled with Tera-WURFL, but the included data may well be outdated by now, and the patch probably isn't enabled by default anyway.

Posted by Steve Kamerman on Tuesday, the 27th of October, 2009.

Hey guys, you should check out the new Tera-WURFL 2.0 - I released RC4 last night and it's very good! It includes the same logic as the new Java WURFL API (maybe the same as the PHP API as well) but it is almost completely backwards compatible with the previous versions of Tera-WURFL. Check it out on www.Tera-WURFL.com

Posted by Simon Harris on Thursday, the 5th of November, 2009.

Thanks for dropping by, Steve. That's pretty exciting news, and I'll be certain to check out Tera-WURFL 2 as soon as I get a free moment.

Enter your comment: