argentum/feed-bundle
Composer 安装命令:
composer require argentum/feed-bundle
包简介
Symfony Bundle to generate RSS Feed with custom namespaces and elements
README 文档
README
ArgentumFeedBundle allows you to create a set of feeds for your content with different settings. All predefined settings can be overridden at runtime.
You can create your own Feed classes and Renderers by defining a service with
tag argentum_feed.feed and argentum_feed.renderer respectively.
Usage
Render a predefined feed:
$rss = $this->get('argentum_feed.factory') ->createFeed('news') ->addFeedableItems($news) ->render();
where $news is a collection of News entities.
To get it to work your News entity should implement Feedable interface:
use Argentum\FeedBundle\Feed\Feedable; use Argentum\FeedBundle\Feed\FeedItem; use Argentum\FeedBundle\Feed\FeedItemEnclosure; use Argentum\FeedBundle\Feed\FeedItemSource; class News implements Feedable { // ... /** * Returns FeedItem instance. * * @return FeedItem */ public function getFeedItem() { $item = new FeedItem(); $item ->setRouteName('news_show') ->setRouteParameters([ 'category' => $this->getCategory()->getSlug(), 'id' => $this->getId(), 'slug' => $this->getSlug(), ]) ->setTitle($this->getTitle()) ->setDescription($this->getAnnounce()) ->setPubDate($this->getPublishedAt()) ->addCustomValue('yandex:full-text', $this->getBody()) ->addCustomValue('mailru:full-text', $this->getBody()); if ($this->getImageMedium()) { $item->addEnclosure( new FeedItemEnclosure($this->getImageMedium()['path'], 'image/jpeg') ); } if ($this->getSourceTitle()) { $item->setSource( new FeedItemSource($this->getSourceTitle(), $this->getSourceUrl()) ); } return $item; } }
Also you can specify a data source provider in the configuration:
argentum_feed: channels: news: title: 'News' link: '/' description: 'News feed' provider: repository: 'ArgentumNewsBundle:News' method: 'findAllPublished' arguments: [10, 'ru']
and then you can just create the feed and render it:
$rss = $this->get('argentum_feed.factory') ->createFeed('news') ->render();
Configuration
Full configuration:
argentum_feed: channels: news: title: 'News' link: '/' description: 'News feed' language: 'ru' copyright: 'ACME' managingEditor: 'Editor' webMaster: 'Webmaster' pubDate: 'now' lastBuildDate: 'now' categories: - { title: 'Category 1', domain: 'domain' } - { title: 'Category 2' } generator: 'ArgentumFeedBundle' docs: 'docs' cloud: domain: 'domain.tld' port: 80 path: '/' registerProcedure: 'register' protocol: 'xmlrpc' ttl: 300 image: url: '/images/logo.png' title: 'News' link: '/' width: 128 height: 96 description: 'News' rating: 'Best' textInput: title: 'Title' description: 'Description' name: 'name' link: 'http://domain.tld' skipHours: [0, 1, 2, 3, 4, 5, 6, 7, 8] skipDays: - 'Saturday' - 'Sunday' namespaces: default: 'http://backend.userland.com/rss2' yandex: 'http://news.yandex.ru' mailru: 'http://news.mail.ru' customElements: - 'yandex:full-text' - 'mailru:full-text' encoding: 'utf-8' translationDomain: 'news' feed: 'feed' renderer: 'rss' provider: repository: 'ArgentumNewsBundle:News' method: 'findAllPublished' arguments: [10, 'ru']
Minimal configuration:
argentum_feed: channels: news: title: 'News' link: '/' description: 'News feed'
All relative links will be converted to absolute using request host. All text content from the predefined configuration will be translated using specified translationDomain.
argentum/feed-bundle 适用场景与选型建议
argentum/feed-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 85.9k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 05 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「feed」 「rss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 argentum/feed-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 argentum/feed-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 argentum/feed-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple RSS generator library for PHP 5.5 or later. clone from Bhaktaraz Bhatta ttps://github.com/bhaktaraz/php-rss-generator
Import an RSS-feed into blog
Google Shopping Feed API (with ns problem fixed)
This module is designed to provide a special alerts feed block for Howard University
RSS builder for Laravel
Small library for obtaining RSS feed with caching.
统计信息
- 总下载量: 85.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-05-22