views:

58

answers:

3

We are looking to build a PHP web application to manage data that is available only through a 3rd party REST like interface.

We would like to use an existing PHP framework to do this, we're considering cakephp and codeigniter, but are open to other options.

We expect the biggest problem will be creating models that utilise the REST API as a data source instead of a local database.

Does anyone have any experience to offer in these areas?

A: 

You might look at Zend_Rest_Client, which I've never used, but appears worth a look.

Failing that, Zend_Http_Client is pretty solid for abstracting away all the curl ugliness.

Either one can be used independently of the rest of the Zend Framework stuff, and should interoperate just fine with other frameworks.

timdev
A: 

You can implement it as a Datasource in Cake, which to the Model and therefore to the rest of the application behaves exactly as a database would. Internally the Datasource can dynamically fetch the data using cURL or the Cake HttpSocket. Have a look at the Twitter API example.

deceze
+1  A: 

I've written a base ReST datasource plugin for CakePHP and am using it in lots of other plugins that interact with ReSTful APIs. Plugins I've released so far are YahooGeoPlanet and bit.ly and I'm also currently working on ones for Google Apis (YouTube and Analytics), Twitter, Twitpic and Facebook. They use the CakePHP's excellent HttpSocket class that deceze mentions.

Have a look at those CakePHP plugins and you should be able to see how simple but powerful they are.

neilcrookes