PHP code example of programster / rss-feed

1. Go to this page and download the library: Download programster/rss-feed library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

programster / rss-feed example snippets




rogramster\RssFeed;

$items = array();

$pubDate = new DateTime();
$pubDate->setTimestamp(1534698676);

$items[] = new RssFeed\RssItem(
    "Article Title", 
    "https://blog.mydomain.org/path/to/article",
    "A description of the article goes here.", 
    $pubDate, 
    "my-article-category"
);

// .. add another item, and another, and another...

$channel = new RssFeed\RssChannel(
    "My Awesome Blog", 
    "https://blog.mydomain.com", 
    "Tutorials on This and That", 
    "en", 
    new RssFeed\NullRssImage(), 
    ...$items
);

$rss = new RssFeed\RssFeed($channel);

header('Content-type: application/xml');
echo $rss;