1. Go to this page and download the library: Download rummykhan/easy-xml library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rummykhan / easy-xml example snippets
$rootNode = new XmlNode('person');
$educationNode = new XmlNode('education');
$educationNode->addAttributes(['MOE' => 'SXC', 'DAE' => 'COE', 'BA' => 'UOS']);
$rootNode->addChildNode($educationNode);
$jobNode = new XmlNode('job');
$jobNode->addAttribute('first', 'https://best-bf.com');
$jobNode->addAttribute('second', 'https://infamous.ae');
$jobNode->addAttribute('third', 'https://awok.com');
$jobNode->addAttribute('fourth', 'https://helpbit.com');
$rootNode->addChildNode($jobNode)
->setDeclaration(XmlDeclaration::V1);
// since it implements php __toString() method
dd((string)$rootNode);
// OR
dd($rootNode->toString());
$rootNode = new XmlNode('employees');
$employeeNode = new XmlNode('employee');
$rootNode->addChildNode($employeeNode);
$rootNode = new XmlNode('name');
$rootNode->setValue('rummykhan');
$rootNode = new XmlNode('person');
$rootNode->addAttribute('age', 30);