Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RESTful Zend Framework API

I'm developing a Zend Framework based application and I found myself writing a skeleton for the API module. I read a bit on the web and I started writing the skeleton based on Zend_Rest_Controller. Turned out ok, key login required to use the API.

The questions started when a colleague of mine started implementing the skeleton in a proper API for one of our applications. He told me he thinks it would be better if we only had an usual Zend_Controller_Action extended in an API controller and in indexAction a Zend_Rest_Server that handles the object.

I'm a bit confused about this. From my personal point of view I'd want to have a "larger-than-average" controller containing each of the 4 actions (get, post, put, delete) and a bit of logic in each action rather than one action ruled by Zend_Rest_Server.

My problem is that I can't figure which of the 2 solutions is better from an architecture point of view; and of course, the most easily maintainable over time.

like image 444
Bogdan Constantinescu Avatar asked Jun 29 '10 14:06

Bogdan Constantinescu


2 Answers

Zend_Rest_Server is generally considered deprecated in favor of Zend_Rest_Controller/Zend_Rest_route. See this post by MWO'P, for instance.

This alone would push me firmly in the direction of Zend_Rest_Controller/Zend_Rest_Route.

like image 129
timdev Avatar answered Sep 23 '22 19:09

timdev


If you want to do REST on Zend I suggest you take a look at the Resauce Framework

like image 33
Darrel Miller Avatar answered Sep 23 '22 19:09

Darrel Miller