PHP code example of nonz250 / simple-rss-maker-php

1. Go to this page and download the library: Download nonz250/simple-rss-maker-php 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/ */

    

nonz250 / simple-rss-maker-php example snippets


$simpleRssMaker = new SimpleRssMaker();

$xml = $simpleRssMaker
    // Channel settings.
    ->setChannel('title', 'link', 'description', 'language', 'copyright', 'category', 'pubDate')
    // Image settings.
    ->setImage('title', 'link', 'url')
    // Item settings.
    ->addItem('title', 'link', 'description', 'author', 'category', 'datetime')
    ->addItem('title', 'link')
    // Generate RSS2.0 string.
    ->rss2();

// If you have more than one article.
$simpleRssMaker = $simpleRssMaker
    // Channel settings.
    ->setChannel('title', 'link', 'description', 'language', 'copyright', 'category', 'pubDate')
    // Image settings.
    ->setImage('title', 'link', 'url');

foreach($items as $item) {
    $simpleRssMaker = $simpleRssMaker
        ->addItem('title', 'link', 'description', 'author', 'category', 'datetime');
}

// Generate RSS2.0 string.
$xml = $simpleRssMaker->rss2();