1. Go to this page and download the library: Download originphp/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/ */
originphp / xml example snippets
use Origin\Xml\Xml;
$data = [
'post' => [
'@category' => 'how tos', // to set attribute use @
'id' => 12345,
'title' => 'How to create an XML block',
'body' => Xml::cdata('A quick brown fox jumps of a lazy dog.'),
'author' => [
'name' => 'James'
]
]
];
$xml = Xml::fromArray($data);