2017 © Pedro Peláez
 

library php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

image

suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  • Saturday, November 4, 2017
  • by suin
  • Repository
  • 21 Watchers
  • 234 Stars
  • 316,753 Installations
  • PHP
  • 24 Dependents
  • 0 Suggesters
  • 62 Forks
  • 3 Open issues
  • 11 Versions
  • 9 % Grown

The README.md

\Suin\RSSWriter

\Suin\RSSWriter is yet another simple RSS writer library for PHP 5.4 or later. This component is Licensed under MIT license., (*1)

This library can also be used to publish Podcasts., (*2)

Latest Stable Version Total Downloads Daily Downloads License Build Status Codacy Badge, (*3)

Quick demo

$feed = new Feed();

$channel = new Channel();
$channel
    ->title('Channel Title')
    ->description('Channel Description')
    ->url('http://blog.example.com')
    ->feedUrl('http://blog.example.com/rss')
    ->language('en-US')
    ->copyright('Copyright 2012, Foo Bar')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->ttl(60)
    ->pubsubhubbub('http://example.com/feed.xml', 'http://pubsubhubbub.appspot.com') // This is optional. Specify PubSubHubbub discovery if you want.
    ->appendTo($feed);

// Blog item
$item = new Item();
$item
    ->title('Blog Entry Title')
    ->description('

Blog body
') ->contentEncoded('
Blog body
') ->url('http://blog.example.com/2012/08/21/blog-entry/') ->author('John Smith') ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900')) ->guid('http://blog.example.com/2012/08/21/blog-entry/', true) ->preferCdata(true) // By this, title and description become CDATA wrapped HTML. ->appendTo($channel); // Podcast item $item = new Item(); $item ->title('Some Podcast Entry') ->description('
Podcast body
') ->url('http://podcast.example.com/2012/08/21/podcast-entry/') ->enclosure('http://podcast.example.com/2012/08/21/podcast.mp3', 4889, 'audio/mpeg') ->appendTo($channel); echo $feed; // or echo $feed->render();

Output:, (*4)

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Channel Title</title>
    <link>http://blog.example.com</link>
    <description>Channel Description</description>
    <language>en-US</language>
    <copyright>Copyright 2012, Foo Bar</copyright>
    <pubDate>Tue, 21 Aug 2012 10:50:37 +0000</pubDate>
    <lastBuildDate>Tue, 21 Aug 2012 10:50:37 +0000</lastBuildDate>
    <ttl>60</ttl>
    <atom:link rel="self" href="http://example.com/feed.xml" type="application/rss+xml"/>
    <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>
    <item>
      <title><![CDATA[Blog Entry Title]]></title>
      <link>http://blog.example.com/2012/08/21/blog-entry/</link>
      <description><![CDATA[<div>Blog body</div>]]></description>
      <content:encoded><![CDATA[<div>Blog body</div>]]></content:encoded>
      <guid>http://blog.example.com/2012/08/21/blog-entry/</guid>
      <pubDate>Tue, 21 Aug 2012 10:50:37 +0000</pubDate>
      <author>John Smith</author>
    </item>
    <item>
      <title>Some Podcast Entry</title>
      <link>http://podcast.example.com/2012/08/21/podcast-entry/</link>
      <description>&lt;div&gt;Podcast body&lt;/div&gt;</description>
      <enclosure url="http://podcast.example.com/2012/08/21/podcast.mp3" type="audio/mpeg" length="4889"/>
    </item>
  </channel>
</rss>

Installation

Easy installation

You can install directly via Composer:, (*5)

$ composer require suin/php-rss-writer

Manual installation

Add the following code to your composer.json file:, (*6)

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

...and run composer to install it:, (*7)

$ composer install

Finally, include vendor/autoload.php in your product:, (*8)

require_once 'vendor/autoload.php';

How to use

The examples directory contains usage examples for RSSWriter., (*9)

If you want to know APIs, please see FeedInterface, ChannelInterface and ItemInterface., (*10)

How to Test

$ vendor/bin/phpunit

Test through PHP 5.4 ~ PHP 7.0

$ docker-compose up

License

MIT license, (*11)

The Versions

04/11 2017

dev-master

9999999-dev https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

php generator feed rss writer

13/07 2017

1.6.0

1.6.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

php generator feed rss writer

21/07 2016

1.5.0

1.5.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Hidehito Nozawa aka Suin

php generator feed rss writer

19/03 2016

1.4.0

1.4.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Hidehito Nozawa aka Suin

php generator feed rss writer

01/03 2016

1.3.3

1.3.3.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Hidehito Nozawa aka Suin

php generator feed rss writer

01/03 2016

1.3.2

1.3.2.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Hidehito Nozawa aka Suin

php generator feed rss writer

21/08 2015

1.3.1

1.3.1.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Hidehito Nozawa aka Suin

php generator feed rss writer

12/03 2014

1.3

1.3.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

generator feed rss writer

23/08 2012

1.2

1.2.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

generator feed rss writer

23/08 2012

1.1

1.1.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

generator feed rss writer

22/08 2012

1.0

1.0.0.0 https://github.com/suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

generator feed rss writer