Looking to hire Laravel developers? Try LaraJobs

laravel-rss maintained by ahmed-aliraqi

Description
RSS builder for Laravel 5
Last update
2018/03/23 17:41 (dev-master)
License
Links
Downloads
63
Tags

Comments
comments powered by Disqus

RSS

RSS builder for Laravel 5

Installation

composer require ahmed-aliraqi/laravel-rss

Usage

Returns the feed

Route::get('/', function()
{
	$feed = Rss::feed('2.0', 'UTF-8');
	$feed->channel([
	    'title'       => "Channel's title",
	    'description' => "Channel's description",
	    'link'        => "http://www.test.com/"
    ]);
    
	for ($i=1; $i<=5; $i++) {
		$feed->item([
		    'title' => 'Item '.$i,
		    'description|cdata' => 'Description '.$i,
		    'link' => 'http://www.test.com/article-'.$i
	    ]);
	}

	return response($feed, 200)->header('Content-Type', 'text/xml');
});

Save the feed

Route::get('/', function()
{
	$feed = Rss::feed('2.0', 'UTF-8');
	$feed->channel([
	    'title'       => "Channel's title",
	    'description' => "Channel's description",
	    'link'        => "http://www.test.com/"
    ]);
    
	for ($i=1; $i<=5; $i++) {
		$feed->item([
		    'title' => 'Item '.$i,
		    'description|cdata' => 'Description '.$i,
		    'link' => 'http://www.test.com/article-'.$i
	    ]);
	}

	$feed->save('test.xml');
});