ahmed-aliraqi / laravel-rss
Laravel 5 的 RSS 构建器
v1.0.0
2018-03-23 16:41 UTC
Requires
- php: >=5.3.0
- illuminate/support: 5.*
This package is auto-updated.
Last update: 2024-08-29 04:41:51 UTC
README
Laravel 5 的 RSS 构建器
安装
composer require ahmed-aliraqi/laravel-rss
用法
返回订阅源
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'); });