Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best PHP lib/class to generate RSS/Atom [closed]

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?

like image 510
Cédric Girard Avatar asked Oct 08 '08 12:10

Cédric Girard


People also ask

What is better Atom or RSS?

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.

What is the difference between Atom feed and RSS feed?

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.

What is Atom link in RSS feed?

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.

How do you use Atom feeds?

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.


3 Answers

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
like image 84
ConroyP Avatar answered Sep 20 '22 13:09

ConroyP


Do you really need a library? Choose format and simply follow its specification to output valid XML.

Here is some tutorial to get started.

like image 41
lubos hasko Avatar answered Sep 19 '22 13:09

lubos hasko


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.

like image 45
Rimas Kudelis Avatar answered Sep 18 '22 13:09

Rimas Kudelis