PHP code example of mayconbordin / rss-l5

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

    

mayconbordin / rss-l5 example snippets


'providers' => array(
    'Thujohn\Rss\RssServiceProvider',
)

'aliases' => array(
    'Rss' => 'Thujohn\Rss\RssFacade',
)

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');
});

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');
});