hyancat/larss
最新稳定版本:v1.4
Composer 安装命令:
composer require hyancat/larss
包简介
RSS builder for Laravel 5
README 文档
README
RSS builder for Laravel 5
Installation
-
Pull down the package with composer:
composer require hyancat/larss -
Add the service provider to your providers array in
app/config/app.phpfile.'Hyancat\Larss\LarssServiceProvider' -
At last, add the alias to the alias array in
app/config/app.phpfile.'RSS' => 'Hyancat\Larss\LarssFacade',
Usage
Usage with Cache:
$rss = \RSS::make(); if (! $rss->caching(10)) { // make channel. $rss->channel([ 'title' => 'title', 'description' => 'description', 'link' => 'http://www.xxx.yyy', ])->withImage([ 'url' => 'http://www.xxx.yyy/logo.png', 'title' => 'title', 'link' => 'http://www.xxx.yyy', ]); // gen posts data ...... foreach ($posts as $post) { $rss->item([ 'title' => $post->title, 'description|cdata' => $post->body, 'link' => $post->url, // ...... ]); } } // If you want to save the rss data to file. $rss->save('rss.xml'); // Or just make a response to the http request. return \Response::make($rss->render(), 200, ['Content-Type' => 'text/xml']);
Usage without Cache:
// make with channel. $rss = \RSS::make()->channel([ 'title' => 'title', 'description' => 'description', 'link' => 'http://www.xxx.yyy', // ...... ])->withImage([ 'url' => 'http://www.xxx.yyy/logo.png', 'title' => 'title', 'link' => 'http://www.xxx.yyy', ]); // gen posts data ...... foreach ($posts as $post) { $rss->item([ 'title' => $post->title, 'description|cdata' => $post->body, 'link' => $post->url, // ...... ]); } return ...;
统计信息
- 总下载量: 562
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-16