Zend Framework 2 offers different Rendering and Response Strategies.
Unfortunately there is no out-of-the-box Strategy for XML.
Solely RSS Feeds are supported:
- https://github.com/zendframework/zf2/blob/master/library/Zend/View/Strategy/FeedStrategy.php
- http://samsonasik.wordpress.com/2012/09/18/zend-framework-2-viewfeedstrategy-generating-feeds/
Well, there is a Module by Alessandro Pietrobelli:
- http://www.alessandropietrobelli.com/2012/11/29/ap_xmlstrategy-1-0-0-a-zend-framework-2-xml-strategy-module/
- https://github.com/alessandropietrobelli/AP_XmlStrategy
If you want to render raw XML you can use these simple lines in your controller:
If you need to create complex XML files you can use the PHP XMLWriter which is included in ZF2:
Backlinks: