Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nkrumahthis/xml-to-array
a simple php xml parser
https://github.com/nkrumahthis/xml-to-array
Last synced: about 2 months ago
JSON representation
a simple php xml parser
- Host: GitHub
- URL: https://github.com/nkrumahthis/xml-to-array
- Owner: nkrumahthis
- License: mit
- Created: 2024-02-21T15:49:48.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-23T23:23:50.000Z (11 months ago)
- Last Synced: 2024-04-23T19:14:20.573Z (9 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# XML to Array Parser
A simple PHP library for parsing XML strings into associative arrays.
## Installation
You can install this package via Composer:
```bash
composer require nkrumahthis/xml-to-array
```## Usage
```php
use Nkrumahthis\XMLToArray\XMLToArray;$xmlString = '
John Doe
30
New York
';$array = XMLToArray::parse($xmlString);
print_r($array);
```This will output
```php
Array
(
[root] => Array
(
[name] => John Doe
[age] => 30
[city] => New York
)
)
```## Testing
To run PHPUnit tests, use:
```php
vendor/bin/phpunit .
```## Contributing
Contributions are welcome! Feel free to submit pull requests or open issues on GitHub: nkrumahthis/xml-to-array.
## License
This package is licensed under the MIT License. See the LICENSE file for details.