jleagle/html-builder

There is no license information available for the latest version (0.0.1) of this package.

A package to create clean HTML

0.0.1 2015-03-07 14:14 UTC

This package is auto-updated.

Last update: 2024-10-09 13:19:48 UTC


README

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