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


Zend_Feed_Reader is a component used to consume RSS and Atom feeds of any version, including RDF/RSS 1.0, RSS 2.0, Atom 0.3 and Atom 1.0. The API for retrieving feed data is deliberately simple since Zend_Feed_Reader is capable of searching any feed of any type for the information requested through the API. If the typical elements containing this information are not present, it will adapt and fall back on a variety of alternative elements instead. This ability to choose from alternatives removes the need for users to create their own abstraction layer on top of the component to make it useful or have any in-depth knowledge of the underlying standards, current alternatives, and namespaced extensions.

Internally, Zend_Feed_Reader works almost entirely on the basis of making XPath queries against the feed XML's Document Object Model. The DOM is not exposed though a chained property API like Zend_Feed though the underlying DOMDocument, DOMElement and DOMXPath objects are exposed for external manipulation. This singular approach to parsing is consistent and the component offers a plugin system to add to the Feed and Entry level API by writing Extensions on a similar basis.

Performance is assisted in three ways. First of all, Zend_Feed_Reader supports caching using Zend_Cache to maintain a copy of the original feed XML. This allows you to skip network requests for a feed URI if the cache is valid. Second, the Feed and Entry level API is backed by an internal cache (non-persistant) so repeat API calls for the same feed will avoid additional DOM or XPath use. Thirdly, importing feeds from a URI can take advantage of HTTP Conditional GET requests which allow servers to issue an empty 304 response when the requested feed has not changed since the last time you requested it. In the final case, an instance of Zend_Cache will hold the last received feed along with the ETag and Last-Modified header values sent in the HTTP response.

In relation to Zend_Feed, Zend_Feed_Reader was formulated as a free standing replacement for Zend_Feed but it is not backwards compatible with Zend_Feed. Rather it is an alternative following a different ideology focused on being simple to use, flexible, consistent and extendable through the plugin system. Zend_Feed_Reader is also not capable of constructing feeds and delegates this responsibility to Zend_Feed_Writer, its sibling in arms.

Zend Framework