popphp/pop-feed
最新稳定版本:2.1.0p1
Composer 安装命令:
composer require popphp/pop-feed
包简介
Pop Feed Component for Pop PHP Framework
README 文档
README
END OF LIFE
The pop-feed component v2.1.0 is now end-of-life and will no longer be maintained.
OVERVIEW
pop-feed is a component for generating and parsing web feeds while trying to normalize
the common nodes and items contained within a feed.
pop-feedis a component of the Pop PHP Framework.
INSTALL
Install pop-feed using Composer.
composer require popphp/pop-feed
BASIC USAGE
Generating a feed
use Pop\Feed\Writer; $headers = [ 'published' => date('Y-m-d H:i:s'), 'author' => 'Test Author' ]; $items = [ [ 'title' => 'Some Item #1', 'link' => 'http://www.popphp.org/', 'description' => 'This is the description of item #1', 'published' => date('Y-m-d H:i:s') ], [ 'title' => 'Some Item #2', 'link' => 'http://popcorn.popphp.org/', 'description' => 'This is the description of item #2', 'published' => date('Y-m-d H:i:s') ] ]; $feed = new Writer($headers, $items); $feed->render();
Rendered as an RSS feed:
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"> <channel> <published>Tue, 21 Jul 2015 18:09:08 -0500</published> <author>Test Author</author> <item> <title>Some Item #1</title> <link>http://www.popphp.org/</link> <description>This is the description of item #1</description> <published>Tue, 21 Jul 2015 18:09:08 -0500</published> </item> <item> <title>Some Item #2</title> <link>http://popcorn.popphp.org/</link> <description>This is the description of item #2</description> <published>Tue, 21 Jul 2015 18:09:08 -0500</published> </item> </channel> </rss>
Or, rendered as an Atom feed:
$feed = new Writer($headers, $items); $feed->setAtom(); $feed->render();
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"> <published>Tue, 21 Jul 2015 18:10:39 -0500</published> <author> <name>Test Author</name> </author> <entry> <title>Some Item #1</title> <link href="http://www.popphp.org/" /> <description>This is the description of item #1</description> <published>Tue, 21 Jul 2015 18:10:39 -0500</published> </entry> <entry> <title>Some Item #2</title> <link href="http://popcorn.popphp.org/" /> <description>This is the description of item #2</description> <published>Tue, 21 Jul 2015 18:10:39 -0500</published> </entry> </feed>
Parsing a feed
If the feed is an RSS feed:
use Pop\Feed\Reader; use Pop\Feed\Format\Rss; $feed = new Reader(new Rss('http://www.domain.com/rss')); foreach ($feed->items as $item) { print_r($item); }
If the feed is an Atom feed:
use Pop\Feed\Reader; use Pop\Feed\Format\Atom; $feed = new Reader(new Atom('http://www.domain.com/feed')); foreach ($feed->entries as $entry) { print_r($entry); }
popphp/pop-feed 适用场景与选型建议
popphp/pop-feed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 863 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「feed reader」 「pop」 「pop php」 「feed writer」 「rss feeds」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 popphp/pop-feed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 popphp/pop-feed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 popphp/pop-feed 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple RSS generator library for PHP 5.5 or later. clone from Bhaktaraz Bhatta ttps://github.com/bhaktaraz/php-rss-generator
laravel facade to read/write csv file
Google Shopping Feed API (with ns problem fixed)
Just parse YAML content to array
This module is designed to provide a special alerts feed block for Howard University
Alfabank REST API integration
统计信息
- 总下载量: 863
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: New
- 更新时间: 2014-12-08