承接 dg/rss-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dg/rss-php

最新稳定版本:v1.5

Composer 安装命令:

composer require dg/rss-php

包简介

RSS & Atom Feeds for PHP is a very small and easy-to-use library for consuming an RSS and Atom feed

README 文档

README

Downloads this Month Latest Stable Version License

RSS & Atom Feeds for PHP is a very small and easy-to-use library for consuming an RSS and Atom feeds.

It requires PHP 5.3 or newer with CURL extension or enabled allow_url_fopen and is licensed under the New BSD License. You can obtain the latest version from our GitHub repository or install it via Composer:

composer require dg/rss-php

Support Me

Do you like RSS? Are you looking forward to the new features?

Buy me a coffee

Thank you!

Usage

Download RSS feed from URL:

$rss = Feed::loadRss($url);

The returned properties are SimpleXMLElement objects. Extracting the information from the channel is easy:

echo 'Title: ', $rss->title;
echo 'Description: ', $rss->description;
echo 'Link: ', $rss->url;

foreach ($rss->item as $item) {
	echo 'Title: ', $item->title;
	echo 'Link: ', $item->url;
	echo 'Timestamp: ', $item->timestamp;
	echo 'Description ', $item->description;
	echo 'HTML encoded content: ', $item->{'content:encoded'};
}

Download Atom feed from URL:

$atom = Feed::loadAtom($url);

You can also enable caching:

Feed::$cacheDir = __DIR__ . '/tmp';
Feed::$cacheExpire = '5 hours';

You can setup a User-Agent if needed:

Feed::$userAgent = "FeedFetcher-Google; (+http://www.google.com/feedfetcher.html)";

If you like it, please make a donation now. Thank you!

统计信息

  • 总下载量: 1.13M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 485
  • 点击次数: 2
  • 依赖项目数: 13
  • 推荐数: 0

GitHub 信息

  • Stars: 481
  • Watchers: 25
  • Forks: 144
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2012-08-31