Provides a HTML Canvas to generate HTML. Inspired by Smalltalk Seaside HTMLCanvas.
Usage:
(new HTML)
->div(fn($h) => $h->span('Hello')
->span('World'))
->a(['class' => 'important', 'href' => 'here.org'],
'I\'m coming');
Will output :
<div>
<span>Hello</span>
<span>World</span>
</div>
<a class="important" href="here.org">I\'m coming</a>
All HTML functions are handled by __call so all method names will be converted to an HTML tag with the same name.
Arguments:
- Optional first argument is an array of key/value pairs that represents HTML tag attributes
- Optional next argument can be either a string for text content, or a Closure for a nested tag
Other functions:
- text : renders text content, useful for chaining
- bi : renders bootstrap icons