PicoFeed - PHP Library to manage Atom and RSS Feeds PicoFeed - 管理 Atom 和 RSS 订阅的 PHP 库
这是原始 picoFeed(已被废弃)的一个分叉。
该分叉版将努力使 picofeed 尽可能简单、快速和现代化,删除所有与解析和创建 feed 无关的内容,并用第三方组件取而代之。最值得注意的是,现在所有 HTTP 请求都由 Guzzle 处理,日志可选择由 Monolog 处理,缓存可选择由 Guzzle Middlewares 处理。
特性
- 简单快捷
- Atom 1.0 和 RSS 0.91、0.92、1.0 和 2.0 的 Feed 解析器
- 适用于 Atom 1.0 和 RSS 2.0 的 Feed 写入器
- Favicon 抓取器
- 导入/导出 OPML 订阅
- 内容过滤器: HTML 清理、移除像素跟踪器和广告
- 代理支持
- 内容抓取器:从原始网站下载完整内容
- 附件检测
- 支持 RTL 语言
- 授权许可 MIT
要求
- PHP >= 7.1
- libxml >= 2.7
- XML PHP extensions: DOM and SimpleXML
- cURL or Stream Context (
allow_url_fopen=On
) - iconv extension
安装
版本
- 开发版本: master
- 稳定版本: 使用最后一个 tag
Install with composer
composer require nicolus/picofeed @stable
使用 Composer 自动加载器的示例:
<?php
require 'vendor/autoload.php';
use PicoFeed\Reader\Reader;
$reader = new Reader;
$resource = $reader->download('http://linuxfr.org/news.atom');
$parser = $reader->getParser(
$resource->getUrl(),
$resource->getContent(),
$resource->getEncoding()
);
$feed = $parser->execute();
echo $feed;
Documentation
- Feed parsing
- Feed creation
- Favicon fetcher
- OPML
- Image proxy (avoid SSL mixed content warnings)
- Web scraping
- Exceptions
- Debugging
- Configuration
- Running unit tests