Download the PHP package benkle/feed-parser without Composer
On this page you can find all versions of the php package benkle/feed-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package feed-parser
A rule-based RSS and Atom parser
This PHP library contains an extensible, rule based parser for RSS and Atom news feeds. It's way of working is inpsired by Alex Debril's feed-io, but it's been rewritten from scratch to be a bit cleaner and more easily extensible. It doesn't have all the features of the original, but you can easily create new parsing standards or extend existing one without rummaging through the library code.
Requirements
- PHP 5.6+
- masterminds/html5 2.2+
- psr/log 1.0+
Installation
FeedParser can be included in the usual way with composer:
Usage
For a quick start you can instantiate the class \Benkle\FeedParser\Reader
and directly fetch a feed:
Create your own rules
FeedParser is based on rules, which are organized on standards.
A rule can be any class implementing \Benkle\FeedParser\Interfaces\RuleInterface
:
Rules can be added to any standard via it's rule set, which is a priority ordered list:
But often you might want to aggregate all your rules in a standard. Standards are classes implementing \Benkle\FeedParser\Interfaces\StandardInterface
:
Adding a standard to a Reader is just as simple as adding a rule to a standard:
Included standards are:
Atom10Standard
for Atom 1.0RSS09Standard
for RSS 0.9RSS10Standard
for RSS 1.0RSS20Standard
for RSS 2.0
Set your own DOM parser
This library uses the PHP DOM library classes for it's XML traversing. To use your own library you have to write a wrapper arround it implementing \Benkle\FeedParser\Interfaces\DOMParserInterface
:
FeedParser already include a wrapper for the standard library, which is fast but fails when a feeds isn't valid XML, and for the Masterminds HTML5 parser, which is more fault tolerant, but also way slower. It also includes a meta wrapper which will try any number of other wrappers it is given, allowing you to balance speed and reliability:
Note: This Wrapper implements Psr\Log\LoggerAwareInterface
and will write notices whenever any of it's protegé throws an exception!
More control
If you need more control over what standards are loaded, and don't need file and http access, you can use the \Benkle\FeedParser\BareReader
class:
TODO
- Moved included class
PriorityList
to a utility package.
All versions of feed-parser with dependencies
masterminds/html5 Version ^2.2
psr/log Version ^1.0
benkle/feed-interfaces Version ^1.1