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

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

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

lucinda/rss

Composer 安装命令:

composer require lucinda/rss

包简介

Very light weight PHP API for RSS feed generation covering official version 2.0 specifications

关键字:

README 文档

README

Very light weight PHP API encapsulating entire RSS-2 specification, the worldwide standard at this moment for generating RSS feeds.

API only requires PHP 8.1+ and comes with a class for each RSS tag, all belonging to Lucinda\RSS namespace, each implementing Tag interface. Following are factually mandatory:

Class Description
RSS Encapsulates rss tag, the grand holder of your RSS feed
Channel Encapsulates channel tag, child of rss, containing your RSS feed description
Item Encapsulates item tag, child of channel, containing an article in your RSS feed

Simple example:

$channel = new \Lucinda\RSS\Channel("Lucinda Framework", "https://www.lucinda-framework.com", "Current headlines from Lucinda Framework");
$channel->addItem(new \Lucinda\RSS\Item("STDOUT MVC API", "STDOUT MVC API was upgraded to a new version"));
$channel->addItem(new \Lucinda\RSS\Item("STDERR MVC API", "STDERR MVC API was upgraded to a new version"));
$rss = new \Lucinda\RSS\RSS($channel);
echo $rss; // displays RSS feed

API enjoys 100% unit test coverage for its classes and methods, reproductible in console by running:

composer update
php test.php

NOTICE: since superglobal __toString is not unit testable, unit tests were done on toString method instead!

RSS

Class RSS encapsulates rss tag logic via following void returning methods:

Method Arguments Description
__construct Channel $channel Constructs feed based on mandatory RSS channel
addNamespace string $name
string $url
Adds a RSS namespace able to add custom functionality to feed

To understand more how namespaces can be used to add non-standard tags to feed, visit this guide!

Channel

Class Channel encapsulates channel tag logic via following void returning methods:

Method Arguments Description
__construct string $title
string $link
string $description
Sets values of required sub-tags: title, link, description [1]
addItem Item $item Sets value of sub-tag item
setLanguage string $language Sets value of sub-tag language
setCopyright string $copyright Sets value of sub-tag copyright
setManagingEditor string $email Sets value of sub-tag managingEditor
setWebMaster string $email Sets value of sub-tag webMaster
setPubDate int $unixTime Sets value of sub-tag pubDate by corresponding unix time
setLastBuildDate int $unixTime Sets value of sub-tag lastBuildDate by corresponding unix time
setCategory string $category Sets value of sub-tag category
setGenerator string $generator Sets value of sub-tag generator
setDocs string $url Sets value of sub-tag docs
setCloud Cloud $cloud Sets value of sub-tag cloud
setTtl int $number Sets value of sub-tag ttl
setImage Image $image Sets value of sub-tag image
setTextInput Input $textInput Sets value of sub-tag textInput
setSkipHours SkipHours $skipHours Sets value of sub-tag skipHours
setSkipDays SkipDays $skipDays Sets value of sub-tag skipDays
addCustomTag Tag $tag Adds custom non-standard sub-tag

[1] Value of $description is automatically escaped using CDATA via Escape class, in order to make it possible to put HTML inside

Item

Class Item encapsulates item tag logic via following void returning methods:

Method Arguments Specification
__construct string $title
string $description
Sets values of required sub-tags: title, description [1]
setLink string $url Sets value of sub-tag link
setAuthor string $email Sets value of sub-tag author
setCategories string $category Sets value of sub-tag categories
setComments string $url Sets value of sub-tag comments
setEnclosure Enclosure $enclosure Sets value of sub-tag enclosure
setGuid string $guid Sets value of sub-tag guid
setPubDate int $unixTime Sets value of sub-tag pubDate by corresponding unix time
setSource string $url Sets value of sub-tag source
addCustomTag Tag $tag Adds custom non-standard sub-tag

[1] Value of $description is automatically escaped using CDATA via Escape class, in order to make it possible to put HTML inside

Tag

Interface Tag defines common ability of all RSS tags to be \Stringable

Escape

Class Escape envelopes a value using CDATA via following method inherited from Tag:

Method Arguments Returns
__toString - string

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

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

它主要适用于以下技术方向: 「feed」 「rss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-25