PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Introduction

Zend_Feed_Writer is the sibling component to Zend_Feed_Reader responsible for generating feeds for output. It supports the Atom 1.0 specification (RFC 4287) and RSS 2.0 as specified by the RSS Advisory Board (RSS 2.0.11). It does not deviate from these standards. It does, however, offer a simple Extension system which allows for any extension and module for either of these two specifications to be implemented if they are not provided out of the box.

In many ways, Zend_Feed_Writer is the inverse of Zend_Feed_Reader. Where Zend_Feed_Reader focuses on providing an easy to use architecture fronted by getter methods, Zend_Feed_Writer is fronted by similarly named setters or mutators. This ensures the API won't pose a learning curve to anyone familiar with Zend_Feed_Reader.

As a result of this design, the rest may even be obvious. Behind the scenes, data set on any Zend_Feed_Writer Data Container object is translated at render time onto a DOMDocument object using the necessary feed elements. For each supported feed type there is both an Atom 1.0 and RSS 2.0 renderer. Using a DOMDocument class rather than a templating solution has numerous advantages, the most obvious being the ability to export the DOMDocument for additional processing and relying on PHP DOM for correct and valid rendering.

As with Zend_Feed_Reader, Zend_Feed_Writer is a standalone replacement for Zend_Feed's Builder architecture and is not compatible with those classes.

Zend Framework