Introducing phpOpenNOS

NOS is a dutch public broadcasting organization focussing mostly on news. Some months ago, NOS announced opening up their data by offering an API which would give access to (some of) their data. Today, the API is opened up to the public and developers who requested API keys will start receiving them. To make it easier for developers to use the API, I've developed a PHP5.3 library.

So what is it?

Basically, the phpOpenNOS library is nothing more than a layer between the API and your application. It is there so you don't have to develop the code to make the requests to the server. At this point, it implements all documented functionality in methods of the OpenNOS class. What you get returned are model classes with getters for all information the server returns.

So what doesn't it do?

It doesn't do any more than giving access to the API. Anything you want to do with the data, you'll have to implement yourself.

So how does it work

As mentioned before, all functionality is implemented as methods of the OpenNOS class. So using this class, you have access to all the API methods. In the repository there is an example.php file that gives you some examples, and more in-depth documentation will follow soon. The code is quite easy to follow though, so probably looking at the method signatures and the docblocks should give you enough information on the available options. A simple example for fetching articles:

<?php
require_once 'src/phpOpenNOS/OpenNOS.php';

$nos = new phpOpenNOS\OpenNOS('YOURAPIKEYHERE');
$articles = $nos->getLatestArticles();

It truly is this simple. The $articles above will now contain an array of Article model classes with get* methods for all properties.

So where to get it?

I already mentioned the repository above, but the code is available from Github. It is the first public repository on the new Ingewikkeld account, which is the account of the company I run with my wife. Because I'm using Github, I would recommend everyone to fork the repository and if you have any improvements or bugfixes, send a pull request so I can get in your fixes and improvements into the main repository. Get phpOpenNOS here at Github.

The Future

As mentioned, documentation is something I need to add. It will come, and hopefully it will come soon. In the README, you will also note that error handling is still in the TODO list: At this point there is no good error handling in place so I will have to add this at some point in the (near) future. Of course, I will keep following the development of the API and adapt the library to any changes in the API as well. And if you have any feedback on phpOpenNOS, I would gladly hear from you!


Add comment

Comments

gravatar Unemployment Claims Kansas City: you may also be curious about benefits you could appreciate along with dental hygienist salaries. secondly, a candidate should make his dressing comply to the customs of the company and the position. brand building a senior marketing professional is the custodian of the brand. in the majority of interviews, the round of questions begins with the interviewer asking about your work history.
March 9, 2013
gravatar mp3 player or ipod: by old, we mean the looks - the technology is every bit modern. shop by price us$ to us$. this means that hitting the gym early won't mean missing your favorite morning radio show.
May 16, 2013

Php5_zce_logo

Tags

1337 2008 2010 2011 4developers access modifiers accessibility AdaLovelaceDay09 advent agavi agile alfred amsterdam amsterdamphp apache api apple article articles atk atkMetaNode audioscrobbler autoloading automation azure backwards compatibility barcelona barcodes bash bbc bbq beatstad belgium best practices bittorrent blogging blogs boards of canada book books bughuntday bundle caching cake cal evans calendar career cat cerf certificate cfp cilex clear cms cologne common sense communities community components composer conference conferences contest continuous integration contribute contribution crisis css curl custom d-day data migration datetime DbFinderPlugin decorator decorators deployment deps devdays development directoryindex directoryiterator docblox doctrine doctrine2 documentation download dpc dpc09 dpc10 dpc11 DPC2008 dreamhost drupal dv7 eclipse ed editors efficiency enterprise errors event events expertise ezcomponents facebook filter-branch filteriterator finland flickr fork framework frameworks free ticket freelance freeze frontend fun game games geoip germany getting real git github globiterator gnome-do google google calendar googletalk graceful degradation hack hackers hidden gem hiphop howto hp HR html http i386 ibuildings icann ide ideasofmarch idm imovie inclusivity indy ingewikkeld integration international php conference internet interview ipad IPC ipc ipc08 ipc10 ipc11se iterators iterm2 javascript jenkins jenkins-php job job openings jobeet john peel joomla joomladays kiva kubuntu launcher launchy left on the web libcurl libraries library lighttpd lime linktuesday linux live london loudblog m2ts mac magazines malware mambo manchester marjolein mediterra meeting meme meta methodology micro-financing microframework microsoft migration movie music mysql namespace namespaces netbeans netherlands newsfire nllgg northeastphp nos odmarco open source opinion ORM osx paradiso paris partnership pavilion pear pecl performance personal pfc10 pfc11 pfcongres pfcongrez pfz pfz.nl photo php PHP php5.3 phpabstract phpazure phpBB phpbb phpbelgium phpbenelux phpbnl10 phpday phpdoc phpdocumentor phpgg phpitalia phpnw phpnw08 phpnw11 phpnw12 phpstorm phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations private projects protected prototype PSR-0 public python qa qr codes re2c recruiting refactoring review rewrite ruby on rails san francisco schedule scifi script security sensio seven things sexism sfdaycgn sflive2011 shell scripting silex simplexml slides smfony software sogeti solar sound speakers spl ssh standard standards star trek static steer strings stylesheets subversion symfony symfony live symfony2 Symfony2 symfonycamp symfonyday symfonylive symfonyUnderControlPlugin talk talks tech techademy technology techportal tek09 telecommuting terratec terrorism testfest testing textmate textpattern the right tool timeout tips tld todo tomas tools training twig uncon unet usability usergroup validation vhost video vim vinyl virus warp webinar weblogging webservices wiki windows winphp women wordpress work workshop world world of warcraft wpi writing wunderlist xml xpath xsd yara year youtube zc11 ZCE zemanta zend zend framework zend server zend studio zendcon Zend_Form zite
© 2004 - 2013 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Delicious, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.4.0.1