htmly/system/vendor/suin/php-rss-writer
2016-07-31 11:52:28 +02:00
..
examples Update composer + sitemap bugs fixes 2015-09-20 21:12:17 +07:00
src/Suin/RSSWriter [CLEANUP] move plugin urilfy to composer setup 2016-07-31 11:52:28 +02:00
Tests [CLEANUP] move plugin urilfy to composer setup 2016-07-31 11:52:28 +02:00
.gitignore Update composer + sitemap bugs fixes 2015-09-20 21:12:17 +07:00
.travis.yml Update composer + sitemap bugs fixes 2015-09-20 21:12:17 +07:00
composer.json Update composer + sitemap bugs fixes 2015-09-20 21:12:17 +07:00
README.md Update composer + sitemap bugs fixes 2015-09-20 21:12:17 +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.

This library can also be used to publish Podcasts.

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);

// RSS item
$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);

// Podcast item
$item = new Item();
$item
	->title("Some Podcast Entry")
	->description("<div>Podcast body</div>")
	->url('http://podcast.example.com/2012/08/21/podcast-entry/')
    ->enclosure('http://link-to-audio-file.com/2013/08/21/podcast.mp3', 4889, 'audio/mpeg')
	->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

Easy installation

You can install directly via Composer:

$ composer require suin/php-rss-writer

Manual installation

Add the following code to your composer.json file:

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

...and run composer to install it:

$ composer install

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

<?php
require_once 'vendor/autoload.php';

How to use

The examples directory contains usage examples for RSSWriter.

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

License

MIT license