vipnytt / opmlparser
OPML parser
Installs: 1 600
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.0
- ext-dom: *
- ext-simplexml: *
Requires (Dev)
- codeclimate/php-test-reporter: >=0.2.0
- phpunit/phpunit: >=4.0
This package is auto-updated.
Last update: 2024-11-05 05:40:27 UTC
README
OPML parser
PHP class to parse OPML documents according to OPML 1.0 and OPML 2.0 specifications.
Requirements:
- PHP >=5.6
Note: HHVM support is planned once facebook/hhvm#4277 is fixed.
Installation
The recommended way to install the robots.txt parser is through Composer. Add this to your composer.json
file:
{ "require": { "vipnytt/opmlparser": "1.0.*" } }
Then run: php composer.phar update
Getting Started
Basic usage example
$parser = new vipnytt\OPMLParser($xml); // Result as Array $array = $parser->getResult() // Validate the result $object = $parser->validate() // \SimpleXMLElement on success | false on failure
Array rendering example
$render = new vipnytt\OPMLParser\Render($array, $version = '2.0'); // as SimpleXMLElement object $object = $render->asXMLObject(); // \SimpleXMLElement // as XML string $string = $render->asXMLObject()->asXML(); // string
Note: OPML version 2.0 is used by default, unless you have specified otherwise. The difference between version 2.0 and 1.0 is the "text" attribute, witch is optional in version 1.0.