Hey! Keep up to date with the project through its beta and public launch by following @getsparks.

 
0
0
0
1,951 Installs

Basic Information: Atomizer

A friendly library for creating and parsing RSS feeds

Contributor : rjzaworski
Email : Log in to view
Author Website : http://rjzaworski.com
Spark Website : https://github.com/rjz/Spark-Atomizer
Repository Type : git
Number of Installs : 1,951

Get the Latest

  • 0.0.3 Pushed October 24th, 2011
    php tools/spark install -v0.0.3 Atomizer Or download this version manually: Get Atomizer-0.0.3.zip

How-To

Atomizer

Atomizer provides a friendly interface for managing RSS data, but it doesn't officially support Atom.

Introduction

Atomizer is available for Codeigniter via Sparks.

Once you've got the spark set up, you can load it using:

$this->load->spark('atomizer/[version #]');

Once Atomizer is loaded, we can get on to more exciting things.

Creating feeds

$info = array(
    'title' => 'my feed'
);

$items = array(
    array(
        'title' => 'my first entry',
        'description' => 'This is the first entry in my new feed'
    ),
    array(
        'title' => 'my second entry',
        'description' => 'This is the second entry in my new feed'
    )
);

$feed = $this->atomizer->create( $info, $items );

Adding items to a feed

$item = new AtomizerItem(array(
    'title' => 'my third feed entry',
    'description' => 'This is a new entry for my feed'
));

$feed->addItem( $item );

(re)Mixing feeds

Two feeds may be combined using the convolve method.

$remix = $feed->convolve( $otherfeed, $info );

Sorting feeds

The order of an RSS feed is time-agnostic, but applications may benefit from having data ordered by publishing time.

$feed->sort();

Saving a feed as XML

header('Content-type: application/rss+xml');
echo $this->atomizer->save( $feed );

Parsing feeds

$url = 'http://rss.news.yahoo.com/rss/topstories';
$feed = $this->atomizer->load( file_get_contents( $url ) );

foreach( $feed->channels as $channel ) {

    $items = $channel->items;

    foreach( $items as $item ) {
        echo '<li>' . $item->title . '</li>';
    }
}

Author

RJ Zaworski rj@rjzaworski.com

License

Atomizer is released under the JSON License. You can read the license here.

Older Versions

  • 0.0.2 Pushed October 4th, 2011
    php tools/spark install -v0.0.2 Atomizer Or download this version manually: Get Atomizer-0.0.2.zip
  • 0.0.1 Pushed September 6th, 2011
    php tools/spark install -v0.0.1 Atomizer Or download this version manually: Get Atomizer-0.0.1.zip

Comments

blog comments powered by Disqus