I have to produce an RSS/Atom feed in various applications, and I want to know a good library or class which is able to produce both, and which already handles all common problems.
For example, the one I used for years does not put the right format for date, so my feed is not well-handled by several aggregators.
Update: Why I am looking for a library? Because the one I used for years, which I had hacked a few times, has a little problem. Maybe a specification is not being correctly followed.
Why does my RSS feed duplicate some entries?
RSS and Atom are the two main standards of web syndication. Atom was developed to avoid the limitations and flaws of RSS. Though Atom is more robust than RSS, the latter still remains a widely used standard.
Each atom feed contains an explicit declaration of the format of the content along with what language is used. RSS feeds do not declare its content, but since it only contains plain text or escaped HTML, it is rather easy for the browser to distinguish which is which. A major flaw of RSS is in its code.
RSS/Atom feeds give good hints about where to find the most recently updated pages. If your website provides an RSS or Atom feed, our crawler will download it to find new links on your site to index first. This is particularly useful when Site Search is doing an incremental update of your website.
To "subscribe" to a site feed, whether RSS or ATOM, you need a feed reader. Simply point the reader to the URL (address) of the site feed, and it will do the rest: it will display the contents of the feed in a window or panel for you. The feed will look like a series of messages.
The PHP Universal Feed Generator seems to be exactly what you're after - it has a simple, OO-based way of declaring a new feed and outputting it to your desired specification.
It also has built-in date format conversions as one of it's features.
Features:
- Generates RSS 1.0, RSS 2.0 and ATOM 1.0 feeds
- All feeds are are validated by feed validator.
- Implements appropriate namespaces for different versions.
- Automatically converts date formats.
- Generates UUID for ATOM feeds.
- Handles CDATA encoding for required tags.
Supported versions:
- RSS 1.0 (which officially obsoleted RSS 0.90)
- RSS 2.0 (which officially obsoleted RSS 0.91, 0.92, 0.93 and 0.94)
- ATOM 1.0
Do you really need a library? Choose format and simply follow its specification to output valid XML.
Here is some tutorial to get started.
Hmmm, IMO, unless you want enclosures, both of these formats are easy enough to craft without any classes. E.g. for the RSS feeds of a website that I administrate, I simply wrote a small Smarty template, and it works pretty smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With