Package Data | |
---|---|
Maintainer Username: | mayconbordin |
Maintainer Contact: | jonathan.thuau@gmail.com (thujohn) |
Package Create Date: | 2015-07-07 |
Package Last Update: | 2015-07-08 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:24:14 |
Package Statistics | |
---|---|
Total Downloads: | 7,384 |
Monthly Downloads: | 12 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 2 |
Total Forks: | 3 |
Total Open Issues: | 0 |
RSS builder for Laravel 5
Add mayconbordin/rss-l5
to composer.json
.
"mayconbordin/rss-l5": "~1.1"
Run composer update
to pull down the latest version of RSS.
Now open up app/config/app.php
and add the service provider to your providers
array.
'providers' => array(
'Thujohn\Rss\RssServiceProvider',
)
Now add the alias.
'aliases' => array(
'Rss' => 'Thujohn\Rss\RssFacade',
)
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');
});