https://github.com/chrisullyott/php-xml
XML-to-array conversion in PHP.
https://github.com/chrisullyott/php-xml
php rss xml
Last synced: 6 months ago
JSON representation
XML-to-array conversion in PHP.
- Host: GitHub
- URL: https://github.com/chrisullyott/php-xml
- Owner: chrisullyott
- License: mit
- Created: 2018-03-24T00:50:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-30T16:04:10.000Z (over 6 years ago)
- Last Synced: 2025-11-27T14:48:48.248Z (7 months ago)
- Topics: php, rss, xml
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-xml
XML-to-array conversion in PHP. Built for pulling items from a variety of RSS feeds.
### Installation
With [Composer](https://getcomposer.org/):
```bash
$ composer require chrisullyott/php-xml
```
### Usage
```php
use ChrisUllyott\XmlParser;
$parser = new XmlParser('path/to/feed.xml'); // or pass in a raw XML string
$items = $parser->getItems();
print_r($items);
```
Each feed item and their child attributes are parsed into a flat structure:
```
(
[0] => Array
(
[title] => News for September the Second
[link] => http://example.com/2002/09/01/news-for-september-the-second
[guid] => 20020901-news-for-september-the-second
[guid_isPermaLink] => 0
[description] => Things happened today!
)
[1] => Array
(
[title] => News for September the First
[link] => http://example.com/2002/09/01/news-for-september-the-first
[guid] => 20020901-news-for-september-the-first
[guid_isPermaLink] => 0
[description] => Things happened today!
)
)
```