views:

175

answers:

3

I am developing a number of Web Applications and CMSes - and have old ones - that I would like to enrich with a RESTful API: The possibility to programmatically access library functions like, say, creating pages, moving them, deleting them, querying content, the things that an API does.

What I am looking for is some kind of a web service construction kit, PHP based, that co-exists with an existing web application and provides the entire skeleton for a REST based web service with all the standard operations, and everything else important: Error handling, possibly authentication, etc.

Say, my web application has a class $address and the methods add($id), edit($id), delete($id), reassign($id), reassign($id, $user) and make_standard($id)`.

The construction toolkit would allow me to create a, I don't know the right name, let's call it case, named "address", and register the abovementioned methods. The toolkit would then do all the magic necessary for me to make a call like (pseudo-code):

www.example.com/api/address/delete/10293049
www.example.com/api/address/reassign/1200923/10203949

In my wet dreams, such a framework would also auto-generate documentation for the services it provides from the API functions and paramters it has defined, and some phpDoc blocks. Everybody can dream, right?

The framework would have to be very unobtrusive which is why I'm shying away a bit from using a full-blown framework that brings along the functions I need as a sub-set. I might end up with one of them, but I'd really prefer a specialized, lightweight application for this purpose.

Does anybody know such a framework, or parts of it, or steps towards it?

+3  A: 

I don't know if there is a Framework directly for this perse, but using Zend Framework along with Zend_Rest_Controller works very well. More here: http://techchorus.net/create-restful-applications-using-zend-framework

Very easy to fit in things like HTTP Authentication if you want to do that.

Andy Baird
+1 for using ZF
Gordon
The tutorial looks interesting and simple. I'll give it a try some time soon, thanks.
Pekka
+1  A: 

For me the choice would be Agavi. It is designed exactly for this kind of stuff.

mst
A: 

CodeIgniter-RestServer is a nice REST Server implementation for the CodeIgniter framework.

Justin Ethier