The best PHP lib/class to generate RSS/Atom

Cédric Girard picture Cédric Girard · Oct 8, 2008 · Viewed 9.6k times · Source

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?

Answer

ConroyP picture ConroyP · Oct 8, 2008

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