htmly/vendor/suin/php-rss-writer
Danang Probo Sayekti 643b3be88d Initial commit
Yay! HTMLy was born today.
2014-01-01 21:56:22 +07:00
..
Source/Suin/RSSWriter Initial commit 2014-01-01 21:56:22 +07:00
Tests Initial commit 2014-01-01 21:56:22 +07:00
.gitignore Initial commit 2014-01-01 21:56:22 +07:00
.travis.yml Initial commit 2014-01-01 21:56:22 +07:00
composer.json Initial commit 2014-01-01 21:56:22 +07:00
example.php Initial commit 2014-01-01 21:56:22 +07:00
README.md Initial commit 2014-01-01 21:56:22 +07:00

\Suin\RSSWriter

\Suin\RSSWriter is yet another simple RSS writer library for PHP 5.3 or later. This component is Licensed under MIT license.

The build status of the current master branch is tracked by Travis CI: Build Status

Implementation:

<?php
$feed = new Feed();

$channel = new Channel();
$channel
	->title("Channel Title")
	->description("Channel Description")
	->url('http://blog.example.com')
	->appendTo($feed);

$item = new Item();
$item
	->title("Blog Entry Title")
	->description("<div>Blog body</div>")
	->url('http://blog.example.com/2012/08/21/blog-entry/')
	->appendTo($channel);


echo $feed;

Output:

<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Channel Title</title>
    <link>http://blog.example.com</link>
    <description>Channel Description</description>
    <item>
      <title>Blog Entry Title</title>
      <link>http://blog.example.com/2012/08/21/blog-entry/</link>
      <description>&lt;div&gt;Blog body&lt;/div&gt;</description>
    </item>
  </channel>
</rss>

Installation

You can install via Composer.

At first create composer.json file:

{
	"require": {
		"suin/php-rss-writer": ">=1.0"
	}
}

Run composer to install.

$ composer install

Finally, include vendor/autoload.php in your product.

require_once 'vendor/autoload.php';

How to Use

example.php is an example usage of RSSWriter.

If you want to know APIs, please see FeedInterface, ChannelInterface and ItemInterface.

License

MIT license