torann/podcastfeed
Composer 安装命令:
composer require torann/podcastfeed
包简介
Generate RSS feeds for podcasts in Laravel 5.
README 文档
README
Generate a RSS feed for podcast for Laravel 5.
Installation
From the command line run
$ composer require torann/podcastfeed
Setup
Once installed you need to register the service provider with the application. Open up config/app.php and find the providers key.
'providers' => [ ... Torann\PodcastFeed\PodcastFeedServiceProvider::class, ... ]
This package also comes with a facade, which provides an easy way to call the the class. Open up config/app.php and find the aliases key
'aliases' => [ ... 'PodcastFeed' => Torann\PodcastFeed\Facades\PodcastFeed::class, ... ];
Publish the configurations
Run this on the command line from the root of your project:
$ php artisan vendor:publish --provider="Torann\PodcastFeed\PodcastFeedServiceProvider"
A configuration file will be publish to config/podcast-feed.php.
Methods
setHeader
The header of the feed can be set in the config file or manually using the setHeader method:
PodcastFeed::setHeader([ 'title' => 'All About Everything', 'subtitle' => 'A show about everything', 'description' => 'Great site description', 'link' => 'http://www.example.com/podcasts/everything/index.html', 'image' => 'http://example.com/podcasts/everything/AllAboutEverything.jpg', 'author' => 'John Doe', 'email' => 'john.doe@example.com', 'category' => 'Technology', 'language' => 'en-us', 'copyright' => '2016 John Doe & Family', ]);
addMedia Adding media to the feed.
foreach($this->podcastRepository->getPublished() as $podcast) { PodcastFeed::addMedia([ 'title' => $podcast->title, 'description' => $podcast->title, 'publish_at' => $podcast->publish_at, 'guid' => route('podcast.show', $podcast->slug), 'url' => $podcast->media->url(), 'type' => $podcast->media_content_type, 'duration' => $podcast->duration, 'image' => $podcast->image->url(), ]); }
toString Converting feed to a presentable string. The example below was pulled from a controller. In theory you could implement a caching method so that it doesn't have to render each time.
public function index() { foreach($this->podcastRepository->getPublished() as $podcast) { PodcastFeed::addMedia([ 'title' => $podcast->title, 'description' => $podcast->title, 'publish_at' => $podcast->publish_at, 'guid' => route('podcast.show', $podcast->slug), 'url' => $podcast->media->url(), 'type' => $podcast->media_content_type, 'duration' => $podcast->duration, 'image' => $podcast->image->url(), ]); } return Response::make(PodcastFeed::toString()) ->header('Content-Type', 'text/xml'); }
Change Log
v0.2.1
- Fixes foreign characters like 'æ', 'ø' and 'å'
v0.2.0
- Support Laravel 5
v0.1.0
- First release
torann/podcastfeed 适用场景与选型建议
torann/podcastfeed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.87k 次下载、GitHub Stars 达 48, 最近一次更新时间为 2015 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xml」 「feed」 「rss」 「laravel」 「podcast」 「podcast generator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 torann/podcastfeed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 torann/podcastfeed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 torann/podcastfeed 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple RSS generator library for PHP 5.5 or later. clone from Bhaktaraz Bhatta ttps://github.com/bhaktaraz/php-rss-generator
Load DOM document safety
Import an RSS-feed into blog
Added a method to Laravel response for handling xml response and also converting Eloquent return to XML.
Google Shopping Feed API (with ns problem fixed)
Uses reflection to map XML to PHP objects.
统计信息
- 总下载量: 5.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 48
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-02-18