PHP code example of louis-dj / xml-template

1. Go to this page and download the library: Download louis-dj/xml-template 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/ */

    

louis-dj / xml-template example snippets



use LouisDj\XmlTemplate\XmlTemplate;

$template = new XmlTemplate('./test.xml');
$output = $template->replaceWith(['randomVar' => 'Some string']);

$subbed = $template->replaceWith([
  'book' => new Book('The Great Gatsby', '1234')
]);
handlebars
{{ foreach arrayVariable as arrayItem }}
<item>The array contains: {{ var arrayItem }}</item>
{{ end }}