PHP code example of hipnaba / indigo-html
1. Go to this page and download the library: Download hipnaba/indigo-html 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/ */
hipnaba / indigo-html example snippets
// Creating elements
$link = new \Indigo\Html\Element\Element('a', [
'class' => 'link',
]);
// Settings attributes
$link->setAttribute('href', '#');
// Working with css classes
$link->addClass('link-default');
// Setting content
$link->setContent('This is a link!');
// Nesting elements
$item = new \Indigo\Html\Element\Element('li');
$item->append($link);
$list = new \Indigo\Html\Element\Element('ul', [
'id' => 'menu',
]);
$list->append($item);
// Rendering elements using the helper
echo $this->htmlElement($list);