dev-master
9999999-devConvert xml to an array
MIT
The Requires
- php >=7.1
The Development Requires
by Vladimir Yuldashev
v1.0.0
1.0.0.0Convert xml to an array
MIT
The Requires
- php >=7.1
The Development Requires
by Vladimir Yuldashev
Wallogit.com
2017 © Pedro Peláez
Convert xml to an array
This package provides a very simple class to convert an xml string to an array., (*2)
Inspired by Spatie's array-to-xml ❤️, (*3)
You can install this package via composer., (*4)
``` bash composer require vyuldashev/xml-to-array, (*5)
## Usage ```php use Vyuldashev\XmlToArray\XmlToArray; $xml = '<items> <good_guy> <name>Luke Skywalker</name> <weapon>Lightsaber</weapon> </good_guy> <bad_guy> <name>Sauron</name> <weapon>Evil Eye</weapon> </bad_guy> </items>'; $result = XmlToArray::convert($xml);
After running this piece of code $result will contain:, (*6)
array:1 [
"items" => array:2 [
"good_guy" => array:2 [
"name" => "Luke Skywalker"
"weapon" => "Lightsaber"
]
"bad_guy" => array:2 [
"name" => "Sauron"
"weapon" => "Evil Eye"
]
]
]
Convert xml to an array
MIT
Convert xml to an array
MIT