PHP code example of rssgen / php-rss-generator

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

    

rssgen / php-rss-generator example snippets



$feed = new Feed();

$channel = new Channel();
$channel
	->title("Programming")
	->description("Programming with php")
	->url('http://bhaktaraz.com.np/?cat=2')
	->appendTo($feed);

// RSS item
$item = new Item();
$item
	->title("CACHING DATA IN SYMFONY2")
	->description("It is not too easy to enhance the performance of your application. In Symfony2 you could get benefit from caching.")
	->url('http://bhaktaraz.com.np/?p=194')
	->enclosure('http://bhaktaraz.com.np/wp-content/uploads/2014/08/bhakta-672x372.jpg', 4889, 'audio/mpeg')
	->appendTo($channel);

echo $feed;


$feed = new Feed();

$channel = new Channel();
$channel
	->title("geekyrepo")
	->description("geekyrepo - for geeks by a geek")
	->url('https://geekyrepo.pasls.com')
	->appendTo($feed);

// Product feed item
$item = new FacebookProductItem();
$item
	->id(78)
	->title("elePHPant Small")
	->description("elePHPant hand made in nepal.")
	->url('https://geekyrepo.pasls.com/product/elephpant-small')
	->availability('in stock')
	->condition('new')
	->googleProductCategory('Apparel & Accessories > Clothing > Underwear & Socks')
	->imageLink('https://geekyrepo.pasls.com/u/591415cc603dc_elephant-blue-small.jpg')
	->brand('GeekyRepo')
	->customLabel0('elephpant-small')
	->customLabel1('ELESM')
	->customLabel2('https://geekyrepo.pasls.com/product/elephpant-small')
	->appendTo($channel);

echo $feed;

composer