thujohn / rss
RSS builder for Laravel 4
Installs: 129 060
Dependents: 3
Suggesters: 0
Security: 0
Stars: 70
Watchers: 7
Forks: 18
Open Issues: 11
Requires
- php: >=5.3.0
- illuminate/support: 4.*|5.*
This package is auto-updated.
Last update: 2024-11-24 04:47:33 UTC
README
RSS builder for Laravel 4
Installation
Add thujohn/rss
to composer.json
.
"thujohn/rss": "~1.0"
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',
)
Usage
Returns the feed
Route::get('/', function()
{
$feed = Rss::feed('2.0', 'UTF-8');
$feed->channel(array('title' => 'Channel\'s title', 'description' => 'Channel\'s description', 'link' => 'http://www.test.com/'));
for ($i=1; $i<=5; $i++){
$feed->item(array('title' => 'Item '.$i, 'description|cdata' => 'Description '.$i, 'link' => 'http://www.test.com/article-'.$i));
}
return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
});
Save the feed
Route::get('/', function()
{
$feed = Rss::feed('2.0', 'UTF-8');
$feed->channel(array('title' => 'Channel\'s title', 'description' => 'Channel\'s description', 'link' => 'http://www.test.com/'));
for ($i=1; $i<=5; $i++){
$feed->item(array('title' => 'Item '.$i, 'description|cdata' => 'Description '.$i, 'link' => 'http://www.test.com/article-'.$i));
}
$feed->save('test.xml');
});