nkrumahthis / xml-to-array
Parses an XML string into an array
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/nkrumahthis/xml-to-array
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is not auto-updated.
Last update: 2025-12-27 19:21:27 UTC
README
A simple PHP library for parsing XML strings into associative arrays.
Installation
You can install this package via Composer:
composer require nkrumahthis/xml-to-array
Usage
use Nkrumahthis\XMLToArray\XMLToArray; $xmlString = '<?xml version="1.0" encoding="UTF-8"?> <root> <name>John Doe</name> <age>30</age> <city>New York</city> </root>'; $array = XMLToArray::parse($xmlString); print_r($array);
This will output
Array ( [root] => Array ( [name] => John Doe [age] => 30 [city] => New York ) )
Testing
To run PHPUnit tests, use:
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.