https://github.com/ericmorand/xml-to-array
Plain and simple XML-to-array converter
https://github.com/ericmorand/xml-to-array
php xml
Last synced: about 2 months ago
JSON representation
Plain and simple XML-to-array converter
- Host: GitHub
- URL: https://github.com/ericmorand/xml-to-array
- Owner: ericmorand
- Created: 2019-02-27T20:50:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T20:19:19.000Z (over 7 years ago)
- Last Synced: 2025-01-26T17:11:17.746Z (over 1 year ago)
- Topics: php, xml
- Language: PHP
- Homepage: https://packagist.org/packages/ericmorand/xml-to-array
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Plain and simple XML-to-array converter
[![Latest Stable Version][packagist-image]][packagist-url] [![Build Status][travis-image]][travis-url]
This package provides a very simple converter to convert an XML string to an array. No attributes support, no complex logic, just a plain and simple converter that just works.
## Installation
```bash
composer require ericmorand/xml-to-array
```
## Usage
```php
foo
foo
";
$array = $converter->convertXML($xml);
```
By running this code, `$array` would contain:
```php
[
'prop0' => null,
'prop1' => 'foo',
'prop2' => 'foo',
'prop3' => [
'prop0' => null,
'prop1' => 'foo',
'prop2' => 'foo'
]
]
```
[packagist-image]: https://poser.pugx.org/ericmorand/xml-to-array/version
[packagist-url]: https://packagist.org/packages/ericmorand/xml-to-array
[travis-image]: https://travis-ci.org/ericmorand/xml-to-array.svg?branch=master
[travis-url]: https://travis-ci.org/ericmorand/xml-to-array