View on GitHub

Easyxml

php xml lib

Download this project as a .zip file Download this project as a tar.gz file

Easyxml

Build Status Scrutinizer Code Quality Code Coverage Stable Status

php xml lib.

Install With Composer:

"require": {
    "eleme/easyxml": "~0.2"
}

Example

array_2_xml(array $array, $structure = '')

$array = array('abc' => array('cba' => 'abc', 'abc' => ''));
echo array_2_xml($array), "\n";
$structure = '<?xml version="1.0" encoding="utf-8"?>';
echo array_2_xml($array, $structure), "\n";

json_2_xml($json, $structure = '')

$json = '{"abc":{"cba":"abc","abc":""}}';
echo json_2_xml($json), "\n";
$structure = '<?xml version="1.0" encoding="utf-8"?>';
echo json_2_xml($json, $structure), "\n";

xml_2_array($xml)

$xml = '<?xml version="1.0"?><abc><cba>abc</cba><abc/></abc>';
echo var_export(xml_2_array($xml)), "\n";

xml_2_json($xml)

$xml = '<?xml version="1.0"?><abc><cba>abc</cba><abc/></abc>';
echo xml_2_json($xml), "\n";