Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 773 Bytes

README.md

File metadata and controls

44 lines (32 loc) · 773 Bytes

html-builder

A package to create clean HTML

Usage

Create elements using their class:

$div = new Div();
$image = new Img('http://example.com/img.png);

Each class has different constructor parameters to help you create the element:

$abbr = new Abbr('WIFI', 'Wireless Fidelity');

Which returns <abbr title="Wireless Fidelity">WIFI</abbr>

And helper methods to do common tasks:

$ul = new Ul();
foreach([1, 2, 3] as $v)
{
  $li = new Li('item '.$v);
  $ul->addListItem($li);
}

Which will echo

<ul>
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
</ul>

Credits

Tag structure taken from [/u/brianjenkins94