lukaswhite / html-element
A really simple PHP class for creating HTML elements
dev-master
2018-08-16 08:12 UTC
Requires (Dev)
- phpunit/php-code-coverage: ^6.0
- phpunit/phpunit: 7.0
This package is auto-updated.
Last update: 2024-10-28 00:53:58 UTC
README
A really simple PHP class for creating HTML elements.
$heading = new HtmlElement( 'h2', 'This is a heading' ); $heading->set( 'class', 'is-title' ); print $heading->render( ); // or, because it implements __toString( ) print $heading
This will output the following:
<h2 class="is-title">This is a heading</h2>
You can also provide another instance when setting content:
$span = new HtmlElement( 'span', 'span content' ); $p = new HtmlElement( 'p' ); $p->setContent( $span );