2017 © Pedro Peláez
 

library html-builder

Simple html builder.

image

kyleblanker/html-builder

Simple html builder.

  • Friday, January 13, 2017
  • by kyleblanker
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

HTMLBuilder

Lightweight html builder, (*1)

Build Status Total Downloads License, (*2)

Examples

Creating a basic element

$builder = new \KyleBlanker\HtmlBuilder\Builder();
$element = $builder->element('p','Hello world');

echo $element->render();

Creating a basic element with an attribute

$builder = new \KyleBlanker\HtmlBuilder\Builder();

$element = $builder->element('p','Hello World')->attribute('style','color: #ff0000');

Nesting elements

$builder = new \KyleBlanker\HtmlBuilder\Builder();

$element = $builder->element('div')->nest(function($builder){
    $builder->element('p','This element is nested');
});

Adding child elements

$builder = new \KyleBlanker\HtmlBuilder\Builder();

$parent = $builder->element('div');

$childElement = $builder->element('p');

$parent->child($childElement);

Creating an html document

$builder = new \KyleBlanker\HtmlBuilder\Builder();
$document = $builder->createDocument();

$document->getHead()->nest(function($builder){
    $builder->element('title','Page Title');
});

$document->getBody()->nest(function($builder){
    $builder->element('div')->attribute('style','background: #ff0000');
});

echo $document->build();

The Versions

13/01 2017

dev-master

9999999-dev

Simple html builder.

  Sources   Download

MIT

The Development Requires

by Kyle Blanker

html builder

13/01 2017

v1.0.0

1.0.0.0

Simple html builder.

  Sources   Download

MIT

The Development Requires

by Kyle Blanker

html builder