Download the PHP package aschmelyun/basic-feeds without Composer
On this page you can find all versions of the php package aschmelyun/basic-feeds. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aschmelyun/basic-feeds
More information about aschmelyun/basic-feeds
Files in aschmelyun/basic-feeds
Package basic-feeds
Short Description A simple PHP library to generate RSS and Atom feeds
License MIT
Homepage https://github.com/aschmelyun/basic-feeds
Informations about the package basic-feeds
Basic Feeds
This package provides a basic way of generating RSS 2 and Atom XML feeds in PHP using a simplified syntax. There are no external dependencies as this package relies on the built-in SimpleXMLElement class.
Installation
Usage
Initialize a feed by using the Feed::create()
method, passing in an array of attributes needed to set up your feed's base.
Then use the entry()
method on the Feed object to attach entries to your feed.
The entry()
method can also expect multiple items at once, using a nested array.
You can then use either the asAtom()
or asRss()
method to compile the feed to the requested format and return it as an XML string:
Requirements
There are a few required attributes, and they change based on the format(s) you choose.
For Feed::create()
they are:
- RSS:
title
,link
,description
- Atom:
title
,link
,authors
,feed
For entry()
they are:
- RSS:
title
,link
,description
- Atom:
title
,link
,summary
,content
Extending
This package comes with an interface that you can use to help extend off of this package to create your own feed generator.
Check out the Atom and RSS classes to see how the included feed generators are structured.
Testing
If you don't already have PHPUnit required in your current project, install this package with dev dependencies:
Then run the PHPUnit tests:
License
This package is licensed under the The MIT License. See LICENSE for more details.