2017 © Pedro Peláez
 

library indigo-html

An HTML abstraction layer.

image

hipnaba/indigo-html

An HTML abstraction layer.

  • Sunday, February 4, 2018
  • by hipnaba
  • Repository
  • 1 Watchers
  • 0 Stars
  • 219 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

Indigo HTML

Indigo HTML tries to simplify HTML element manipulation. It does not work with DOMElement but provides an API of its own. It also provides integration with Zend View in the form of view helpers., (*1)

Installation

composer require hipnaba/indigo-html dev-master

Usage

<?php
// 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);

The above example would render something like this:, (*2)

<ul id="menu">
    <li>
        <a class="link link-default" href="#">This is a link!</a>
    </li>
</ul>

The Versions