PhpRiot
News Archive
Related Articles
PhpRiot Newsletter
Your Email Address:

More information

Responding to Different Content Types in RESTful ZF Apps

Note: This article was originally published at phly, boy, phly on 11 March 2010.

In previous articles, I've explored building service endpoints and RESTful services with Zend Framework. With RPC-style services, you get to cheat: the protocol dictates the content type (XML-RPC uses XML, JSON-RPC uses JSON, SOAP uses XML, etc.). With REST, however, you have to make choices: what serialization format will you support?

Why not support multiple formats?

There's no reason you can't re-use your RESTful web service to support multiple formats. Zend Framework and PHP have plenty of tools to assist you in responding to different format requests, so don't limit yourself. With a small amount of work, you can make your controllers format agnostic, and ensure that you respond appropriately to different requests.


Continue reading "Responding to Different Content Types in RESTful ZF Apps"