PHP code example of dantleech / object-renderer
1. Go to this page and download the library: Download dantleech/object-renderer 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/ */
dantleech / object-renderer example snippets
$renderer = ObjectRendererBuilder::create()
->addTemplatePath('example/path')
->build();
$renderer->render(new \stdClass());
$dom = new DOMDocument();
$child1 = $dom->createElement('child-1');
$child1->setAttribute('foo', 'bar');
$dom->appendChild($child1);
$child2 = $dom->createElement('child-2');
$child2->setAttribute('bar', 'foo');
$dom->appendChild($child2);
$renderer = ObjectRendererBuilder::create()
->addTemplatePath('example/path')
->build();
$renderer->render($dom);