Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lib16/rss-builder-php

lib16 RSS Builder is a PHP 7 library for creating RSS feeds.
https://github.com/lib16/rss-builder-php

composer feeds php php-library php7 rss rss-builder rss-writer

Last synced: about 2 months ago
JSON representation

lib16 RSS Builder is a PHP 7 library for creating RSS feeds.

Awesome Lists containing this project

README

        

# Lib16 RSS Builder for PHP 7
A library for creating RSS feeds written in PHP 7.

[![Build Status](https://travis-ci.com/lib16/rss-builder-php.svg?branch=master)](https://travis-ci.com/lib16/rss-builder-php)
[![Coverage](https://codecov.io/gh/lib16/rss-builder-php/branch/master/graph/badge.svg)](https://codecov.io/gh/lib16/rss-builder-php)

## Installation with Composer
This package is available on [packagist](https://packagist.org/packages/lib16/rss), so you can use [Composer](https://getcomposer.org) to install it.
Run the following command in your shell:

```
composer require lib16/rss
```

## Basic Usage
Example markup is taken from [en.wikipedia.org/wiki/Rss](https://en.wikipedia.org/wiki/Rss)

```php
pubDate(new DateTime('2010-09-06 00:01 +0'))
->lastBuildDate(new DateTime('2009-09-06 16:20 +0'))
->ttl(1800);

$channel
->item(
'Example entry',
'Here is some text containing an interesting description.',
'http://www.example.com/blog/post/1'
)
->guid('7bd204c6-1655-4c27-aeee-53f933c5395f', false)
->pubDate(new DateTime('2009-09-06 16:20 +0'));

RssMarkup::headerfields('example');
print $channel;
```
… generates the following output:

```xml


RSS Title
This is an example of an RSS feed
http://www.example.com/main.html
Mon, 06 Sep 2010 00:01:00 +0000
Sun, 06 Sep 2009 16:20:00 +0000
1800

Example entry
Here is some text containing an interesting description.
http://www.example.com/blog/post/1
7bd204c6-1655-4c27-aeee-53f933c5395f
Sun, 06 Sep 2009 16:20:00 +0000

```