eleme/easyxml

PHP xml library

v0.3.0 2014-11-18 10:58 UTC

This package is not auto-updated.

Last update: 2024-11-05 02:21:18 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Stable Status

php xml lib.

Install With Composer:

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

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";