- Saved searches
- Use saved searches to filter your results more quickly
- aherne/rss-generator
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- mibe/FeedWriter
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- bhaktaraz/php-rss-generator
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
aherne/rss-generator
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
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 |
$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!
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!
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 |
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 |
Interface Tag defines common ability of all RSS tags to be \Stringable
Class Escape envelopes a value using CDATA via following method inherited from Tag:
Method | Arguments | Returns |
---|---|---|
__toString | — | string |
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
PHP Universal Feed Generator
License
mibe/FeedWriter
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Generate RSS 1.0, RSS 2.0 or ATOM Formatted Feeds
This package can be used to generate feeds in either RSS 1.0, RSS 2.0 or ATOM format.
Applications can create a feed object, several feed item objects, set several types of properties of either feed and feed items, and add items to the feed.
Once a feed is fully composed with its items, the feed class can generate the necessary XML structure to describe the feed in RSS or ATOM format. This structure can be directly sent to the browser, or just returned as string.
If you don’t have PHP 5.3 available on your system there is a version supporting PHP 5.0 and above. See the legacy-php-5.0 branch.
composer require mibe/feedwriter
The documentation can be found in the gh-pages branch, or on GitHub Pages.
See the /examples directory for usage examples.
See the CHANGELOG.md file for changes between the different versions.
- Anis uddin Ahmad
- Michael Bemmerl
- Phil Freo
- Paul Ferrett
- Brennen Bearnes
- Michael Robinson
- Baptiste Fontaine
- Kristián Valentín
- Brandtley McMinn
- Julian Bogdani
- Cedric Gampert
- Yamek
- Thielj
- Pavel Khakhlou
- Daniel
- Tino Goratsch
About
PHP Universal Feed Generator
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
RSS generator library for PHP
License
bhaktaraz/php-rss-generator
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
\Bhaktaraz\RSSGenerator is RSS generator library for PHP 5.5 or later.
You can install via Composer.
Add in your composer.json file:
< "require": < "bhaktaraz/php-rss-generator": "dev-master" > >
$feed = new Feed(); $channel = new Channel(); $channel ->title("Programming") ->description("Programming with php") ->url('http://bhaktaraz.com.np/?cat=2') ->appendTo($feed); // RSS item $item = new Item(); $item ->title("CACHING DATA IN SYMFONY2") ->description("It is not too easy to enhance the performance of your application. In Symfony2 you could get benefit from caching.") ->url('http://bhaktaraz.com.np/?p=194') ->enclosure('http://bhaktaraz.com.np/wp-content/uploads/2014/08/bhakta-672x372.jpg', 4889, 'audio/mpeg') ->appendTo($channel); echo $feed;
xml version="1.0"?> rss version="2.0"> channel> title>Programmingtitle> link>http://bhaktaraz.com.np/?cat=2link> description>Programming with phpdescription> item> title>CACHING DATA IN SYMFONY2title> link>http://bhaktaraz.com.np/?p=194link> description>It is not too easy to enhance the performance of your application. In Symfony2 you could get benefit from caching.description> enclosure url="http://bhaktaraz.com.np/wp-content/uploads/2014/08/bhakta-672x372.jpg" type="audio/mpeg" length="4889"/> item> channel> rss>
Facebook product feed implementation:
$feed = new Feed(); $channel = new Channel(); $channel ->title("geekyrepo") ->description("geekyrepo - for geeks by a geek") ->url('https://geekyrepo.pasls.com') ->appendTo($feed); // Product feed item $item = new FacebookProductItem(); $item ->id(78) ->title("elePHPant Small") ->description("elePHPant hand made in nepal.") ->url('https://geekyrepo.pasls.com/product/elephpant-small') ->availability('in stock') ->condition('new') ->googleProductCategory('Apparel & Accessories > Clothing > Underwear & Socks') ->imageLink('https://geekyrepo.pasls.com/u/591415cc603dc_elephant-blue-small.jpg') ->brand('GeekyRepo') ->customLabel0('elephpant-small') ->customLabel1('ELESM') ->customLabel2('https://geekyrepo.pasls.com/product/elephpant-small') ->appendTo($channel); echo $feed;
rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:g="http://base.google.com/ns/1.0" version="2.0"> channel xmlns:g="http://base.google.com/ns/1.0"> title>geekyrepotitle> link>https://geekyrepo.pasls.comlink> description>geekyrepodescription> item xmlns:g="http://base.google.com/ns/1.0"> g:id xmlns:g="http://base.google.com/ns/1.0">78g:id> g:title xmlns:g="http://base.google.com/ns/1.0">elePHPant Smallg:title> g:link xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/product/elephpant-small g:link> g:description xmlns:g="http://base.google.com/ns/1.0">elePHPant hand made in nepal.g:description> g:availability xmlns:g="http://base.google.com/ns/1.0">in stockg:availability> g:price xmlns:g="http://base.google.com/ns/1.0">699 NPRg:price> g:condition xmlns:g="http://base.google.com/ns/1.0">newg:condition> g:google_product_category xmlns:g="http://base.google.com/ns/1.0"> Apparel & Accessories > Clothing > Underwear & Socks g:google_product_category> g:image_link xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/u/591415cc603dc_elephant-blue-small.jpg g:image_link> g:brand xmlns:g="http://base.google.com/ns/1.0">geekyrepog:brand> g:custom_label_0 xmlns:g="http://base.google.com/ns/1.0">elephpant-smallg:custom_label_0> g:custom_label_1 xmlns:g="http://base.google.com/ns/1.0"> https://geekyrepo.pasls.com/product/elephpant-small g:custom_label_1> g:custom_label_2 xmlns:g="http://base.google.com/ns/1.0">ELESMg:custom_label_2> item> channel> rss>
About
RSS generator library for PHP