PHP code example of gemorroj / rss

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

    

gemorroj / rss example snippets



use Rss\Generator;
use Rss\Model\Enclosure;
use Rss\Model\Item;

$generator = new Generator('example.com rss', 'http://example.com', 'some description');
$generator->addItem(
    new Item(
        title: 'one item',
        link: 'http://example.com',
        description: 'some description',
        date: new \DateTime('yesterday'),
        guid: 'post-1',
        enclosure: new Enclosure('http://example.com/ep1.mp3', 12216320, 'audio/mpeg'),
    )
);

echo $generator->saveXML(); // rss xml
// $generator->output(); // send rss to browser


use Rss\Parser;

$xml = '<?xml version="1.0" encoding="UTF-8"