PHP Classes

Shikiryu PHP RSS Feed Reader and Generator: Create and read RSS feed files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 66 All time: 10,202 This week: 404Up
Version License PHP version Categories
shikiryurss 1.0.0The PHP License5XML, PHP 5, Parsers


This class can create and read RSS feed files.

It extends the PHP DOMDocument class to provide additional functions to a parser or generated RSS feed XML files.

Currently it can:

- Retrieve and parse RSS feeds from a given URL

- Get feed properties as class variables

- Get feed items as objects or arrays

- Create a new RSS feed from scratch

- Set feed properties by assigning variables

- Add feed items passing item objects

- Save the feed to a file

Picture of Chouchen
  Performance   Level  
Name: Chouchen <contact>
Classes: 5 packages by
Country: France France
Age: ???
All time rank: 265973 in France France
Week rank: 578 Up20 in France France Up
Innovation award
Innovation award
Nominee: 3x

Winner: 2x


All documentation @

disclaimer: This class is functionnal. Anyway, use it only if you don't have other choices. For example, Zend and Symfony got their own RSS factory, don't add another one in.

How to make it read RSS?

First, we need to load the RSS :

$rss = SRSS::read('');

Easy, right? Then you can extract general informations :

echo $rss->title; // will display blog title

Then, you can take care of articles. You can select a precise article :

$article1 = $rss->getItem(1); // or $rss->getFirst();

Or looping them :

foreach($rss as $article)
    echo '<a href="'.$article->link.'">'. SRSSTools::formatDate('d/m/y', $item->pubDate).' '.$item->title.'';

If you like arrays, you can transform the RSS into an array :

$rssArray = $rss->toArray();

You can also save it into your server with :

$rss->save('/www/rss/rss.xml'); // example

How to make it create RSS?

First, we need to initialize the RSS :

$rss = SRSS::create();

Easy, right? Then you can add general informations :

$rss->title = 'My Awesome Blog';
$rss->link = '';
$rss->description = 'is awesome';

Those 3 are mandatory to validate your RSS, other options can be added. Then, you can add articles. Let's imagine $content contains an array from your database.

foreach($content as $item){
    $rssitem= new SRSSItem; // we create an item
    $rssitem->title = $item["title"]; // adding title (option)
    $rssitem->link = $item['link']; // adding link (option)
    $rssitem->pubDate = $item["date"]; // date automatically transformed into RSS format (option)
    $rssitem->description = $item["text"]; // adding description (mandatory)
    $rss->addItem($rssitem); // we add the item into our RSS

There are 2 functions to add item. The first one will add items in the order you enter them, from top to bottom.


The other one does the opposite and add the next item in top of your RSS


Contact :

  Files folder image Files  
File Role Description
Accessible without login Plain text file Doc. Documentation
Plain text file srss.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,202
This week:404Up