Normally we will use the View to output HTML, but sometimes we want a more diverse way of outputting for example JSON or XML. This recipe will provide us with enough information to accomplish this easily.
We simply require the Zend Framework 2 skeleton application to get us going with this recipe. Nothing exotic is required.
Using different view strategies and renderers is a common practice in an application. In this recipe we'll explain how to do that.
We can easily add a view strategy to our application by simply appending the
view_manager configuration in the module configuration file (
/module/Restful/config/module.config.php) as shown as follows:
<?php return array( ...