Skip to content

Jleagle/html-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

HTML Builder

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages