Download the PHP package kfosoft/php-xml-helper without Composer
On this page you can find all versions of the php package kfosoft/php-xml-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download kfosoft/php-xml-helper
More information about kfosoft/php-xml-helper
Files in kfosoft/php-xml-helper
Download kfosoft/php-xml-helper
More information about kfosoft/php-xml-helper
Files in kfosoft/php-xml-helper
Please rate this library. Is it a good library?
Informations about the package php-xml-helper
PHP XML Helper
Class for encode xml string to array or object & encode array to SimpleXMLElement
Installation
Installation with Composer
Either run
php composer.phar require --prefer-dist kfosoft/php-xml-helper:"*"
or add in composer.json
"require": {
...
"kfosoft/php-xml-helper":"*"
}
Well done!
Example encode
$xml = (new XML())->encode(array(
'book' => array(
1,
'page' => 1,
),
'book1' => array(
'attribute:test' => 2,
'attribute:test2' => 'testValue',
'page' => 1,
'page1' => 'testValue',
),
), 'document')
Result:
<?xml version="1.0"?>
<document><book><item>1</item><page>1</page></book><book1 test="2" test2="testValue"><page>1</page><page1>testValue</page1></book1></document>
Example decode
$xml = '<?xml version="1.0"?>
<document><book><item>1</item><page>1</page></book><book1 test="2" test2="testValue"><page>1</page><page1>testValue</page1></book1></document>';
$xml = (new XML())->decode($xml);
or
$xml = (new XML())->decode($xml,true);
Result:
To array:
array(2) {
'book' =>
array(2) {
[0] =>
string(1) "1"
'page' =>
string(1) "1"
}
'book1' =>
array(3) {
'attribute:' =>
array(2) {
'test' =>
string(1) "2"
'test2' =>
string(9) "testValue"
}
'page' =>
string(1) "1"
'page1' =>
string(9) "testValue"
}
}
To object:
class stdClass#62 (2) {
public $book =>
array(2) {
[0] =>
string(1) "1"
'page' =>
string(1) "1"
}
public $book1 =>
array(3) {
'attribute:' =>
array(2) {
'test' =>
string(1) "2"
'test2' =>
string(9) "testValue"
}
'page' =>
string(1) "1"
'page1' =>
string(9) "testValue"
}
}
Enjoy, guys!
All versions of php-xml-helper with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4.0
The package kfosoft/php-xml-helper contains the following files
Loading the files please wait ....