At some point such RESTful interface could make it attractive to multiple languages, e.g. Java and frameworks like JAX-RS[?]
Werner On Tue, Apr 23, 2013 at 10:14 PM, Gareth McCumskey <[email protected]>wrote: > Well it seems like the demand is there. Building a W3C standards compliant > version of the PHP library for the DeviceMap/OpenDDR data files is actually > not that complex. It just takes a bit of time. I had 2 days to build the > initial library (along with the usual other cruft and requests that come on > as a developer during the course of a day) so had to whip something up > quick. > > @Reza: Wrapping it with a RESTful interface would be very simple but I'd > rather not do it with my current library as it is very thrown together. > Ultimately all it is designed to do right now is loop through the > BuilderDataSource.xml to match all of the <list> items to any strings in > the user agent, then search the DeviceDataSource.xml for the device id, and > loop through the parents and build a capabilities array for the users > device accessible to the developer with a few lines of code as simple as: > > <?php > include_once > (dirname(__FILE__)."/lib/JMOpenDDR/BuilderDataSource.class.php"); > include_once > (dirname(__FILE__)."/lib/JMOpenDDR/DeviceDetection.class.php"); > > > $user_agent_test = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 > (KHTML, like Gecko) Chrome/27.0.1453.12 Safari/537.36"; > $new_device_detection = new DeviceDetection($user_agent_test); > > if ($new_device_detection->getProperty('is_wireless_device')) > { > echo "This is a wireless device!!"; > } > else > { > echo "This is NOT a wireless device!!"; > } > > There is one very big problem with the OpenDDR data files is that they do > not seem to include details of desktop browsers. So the library is forced > to make the assumption that if the device is not in the list all > capabilities are available because it is probably a desktop browser when > the better practice would be to assume the device has NO capabilities > beyond the generic device if it is not listed in the DDR to ensure better > compatibility with older feature phones. > > Lastly, the current library I cannot redistribute. It was unfortunately > built as part of my work at my present employer and as such they retain the > copyright on that work and knowing them they will not allow it to be > released to the open source community at large. > > Now I will shut up and let others talk hehe > > > On Tue, Apr 23, 2013 at 7:39 PM, Werner Keil <[email protected]> > wrote: > > > Sounds cool, > > > > Beside Java and a still early stage C# port, languages like PHP, Python, > > Ruby and maybe a few others (Scala, those could theoretically benefit > from > > Java client via JVM, too) sound like a very good idea. > > > > From at least 2 conferences we both spoke at, I know Stephan Hochdörfer > > from a rather active PHP shop in Mannheim, Germany: > > http://blog.bitexpert.de/author/stephan-hochdoerfer/ sorry his profile > is > > mostly German, at least Christian and a few other German speakers should > be > > able to read. Those guys may also be interested in a PHP port or be able > to > > contribute if they have commercial need and clients for it. > > > > Regards, > > Werner > > > > On Tue, Apr 23, 2013 at 9:34 PM, Carlos D'Agostino < > > [email protected]> wrote: > > > > > Hi, > > > > > > I'm also woking in a PHP and Java-oriented company. I also do a lot of > > Ruby > > > coding on my own time. > > > > > > I'd be more than willing to contribute with code to porting libraries > to > > > these languages. > > > > > > Regards, > > > > > > > > > On Tue, Apr 23, 2013 at 7:11 PM, Christian Stocker < > > > [email protected]> wrote: > > > > > > > JFYI, I'm a PHP guy and following this list since the beginning and > I'm > > > > working in a PHP company, so we'd be very interested in such a > library > > > > > > > > chregu > > > > > > > > On 23.04.13 17:13, Reza wrote: > > > > > Hey Greg, do you have the code posted anywhere? Would it be easy to > > > wrap > > > > your code with a JSON service so it can be tested against the other > > APIs? > > > > > > > > > > Not sure if there are any PHP guys on the team, Im not very > familiar > > > > with it. Im certain there will be interest in this because PHP is so > > > > popular. > > > > > > > > > > > > > > > ________________________________ > > > > > From: Gareth McCumskey <[email protected]> > > > > > To: [email protected] > > > > > Sent: Tuesday, April 23, 2013 10:22 AM > > > > > Subject: PHP Client Library > > > > > > > > > > > > > > > Hi guys, > > > > > > > > > > Recently joined the mailing list and was looking a few weeks ago to > > > find > > > > a > > > > > client library for DeviceMap or OpenDDR in order to use for our web > > > > > application. Formerly we were using Tera WURFL. > > > > > > > > > > Seeing as I couldn't really find a complete one that I liked I > ended > > up > > > > > developing my own. It was actually pretty quick and dirty just to > get > > > the > > > > > job done due to time constraints so its not following the standards > > per > > > > se. > > > > > > > > > > I was wondering if the project would like to have a more complete > > > library > > > > > contributed in order to more easily support PHP applications? > > > > > > > > > > > > > -- > > > > Liip AG // Feldstrasse 133 // CH-8004 Zurich > > > > Tel +41 43 500 39 81 // Mobile +41 76 561 88 60 > > > > www.liip.ch // blog.liip.ch // GnuPG 0x0748D5FE > > > > > > > > > > > > > > > > > -- > > > Carlos D'Agostino. > > > > > > > > > -- > Gareth McCumskey > http://garethmccumskey.blogspot.com > twitter: @garethmcc > identi.ca: @garethmcc >
