tonivdv / php-dom-utils
Provides an easy way to fill a DOMDocument with an array
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tonivdv/php-dom-utils
Requires (Dev)
- phpunit/phpunit: ~4.7
This package is auto-updated.
Last update: 2025-10-18 10:31:34 UTC
README
Provides an easy way to fill a DOMDocument with an array
$array = array(
  "nodes" => array(
    "node" => array(
      0 => "text1",
      1 => "text2"
    )));
$dom = new \DOMDocument('1.0', 'utf-8');
PhpDomUtils::fillDom($dom, $array);
echo $dom->saveXML();
Above example would output:
<?xml version="1.0" encoding="utf-8"?>
<nodes>
  <node>text1</node>
  <node>text2</node>
</nodes>