Download the PHP package lucinda/rss without Composer
On this page you can find all versions of the php package lucinda/rss. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package rss
Short Description Very light weight PHP API for RSS feed generation covering official version 2.0 specifications
License MIT
Homepage https://github.com/aherne/rss-generator
Informations about the package rss
PHP RSS Feed Generator API
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:
API enjoys 100% unit test coverage for its classes and methods, reproductible in console by running:
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 |