vinelab/rss 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

vinelab/rss

Composer 安装命令:

composer require vinelab/rss

包简介

An elegant RSS 2.0 and Atom client.

README 文档

README

Build Status

RSS Client

A simple and radical RSS client that supports RSS 0.92, 2.0 and Atom feeds.

Synopsis

Fetch Feeds

$rss->feed('https://stackoverflow.com/feeds/tag?tagnames=php&sort=newest');

Parse Feeds

$feed->info();
$feed->articles();

Installation

composer require vinelab/rss

Laravel Setup

Edit app.php and add 'Vinelab\Rss\RssServiceProvider', to the 'providers' array.

It will automatically alias itself as RSS so no need to aslias it in your app.php unless you would like to customize it. In that case edit your 'aliases' in app.php adding 'MyRSS' => 'Vinelab\Rss\Facades\RSS',

Usage

Fetch an RSS feed

require 'vendor/autoload.php';

use Vinelab\Rss\Rss;

$rss = new Rss();
$feed = $rss->feed('https://stackoverflow.com/feeds/tag?tagnames=php&sort=newest');

// $feed is now an instance of Vinelab\Rss\Feed

$info = $feed->info();
$count = $feed->articlesCount();
$articles = $feed->articles();

Feed Info

$info = $feed->info();

echo json_encode($info);
{
   "title": "Newest questions tagged php - Stack Overflow",
   "subtitle": "most recent 30 from stackoverflow.com",
   "updated": "2020-07-16T19:14:29Z",
   "id": "https://stackoverflow.com/feeds/tag?tagnames=php&sort=newest"
 }

Feed Articles

Accessing Articles

$articles = $feed->articles();

This will give you an instance of Vinelab\Rss\ArticlesCollection which is an extension of Illuminate\Support\Collection. Each item of this collection is an instance of Vinelab\Rss\Article from which you can safely access any of the properties in the entry.

Article

Is an object which properties are dynamically accessed such as $article->title.

Whichever fields exist in the feed's entry will be accessible as read-only property, making Article an immutable object.

You may also call isset($article->someField) to check whether the field exists for a designated entry.

$article = $articles->first();

echo $article->title; // ABBA piano seen raising money, money, money at auction

echo $article->whatever; // null

Or iterate through the articles

foreach ($feed->articles() as $article) {
  $title = $article->title;
}

You may also access the article's original XML format with

$article->xml();

Got Questions?

Reach out in the issues.

MIT LICENSE

vinelab/rss 适用场景与选型建议

vinelab/rss 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43.11k 次下载、GitHub Stars 达 48, 最近一次更新时间为 2013 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vinelab/rss 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vinelab/rss 我们能提供哪些服务?
定制开发 / 二次开发

基于 vinelab/rss 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 43.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 50
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 48
  • Watchers: 4
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-16