VELOX API Docs

HTML
in package

A class that serves as a fluent interface to write HTML in PHP. It also helps with creating HTML elements on the fly.

Example:

// return an HTML element by using some tag name as a static method
// div can be replaced by any other html element name
$html = HTML::div('This is a div!', ['class' => 'container']);

// structuring deeply nested elements using wrapping methods
// ->condition() to make the next action conditional
// ->execute() to execute some logic (loops, complex if-statements)
// ->open() and ->close() for containing elements
// ->{$tagName}() or ->element() for elements, ->entity() for entities, ->comment() for comments
// ->echo() or ->return() for retrieving the final result
(new HTML())
    ->element('h1', 'HTML Forms', ['class' => 'title'])
    ->open('form', ['method' => 'POST'])
        ->h2('Example', ['class' => 'subtitle'])
        ->p('This is an example form.')
        ->br(null)
        ->condition($someVar === true)->div('The var was true')
        ->open('fieldset')
            ->legend('Form 1', ['style' => 'color: #555;'])
            ->label('Message: ', ['class' => 'text'])
            ->input(null, ['type' => 'text', 'required'])
            ->entity('nbsp', 2)
            ->input(null, ['type' => 'submit', 'value' => 'Submit'])
        ->close()
        ->condition(count($errors))
        ->open('ul', ['class' => 'errors'])
            ->execute(function () use ($errors) {
                foreach ($errors as $error) {
                    $this->li($error);
                }
            })
        ->close()
    ->close()
->echo();
Tags
since
1.0.0

Table of Contents

$buffer  : array<string|int, mixed>
$conditions  : array<string|int, mixed>
$stack  : array<string|int, mixed>
$validate  : bool
__call()  : mixed
Makes HTML tags available as methods on the class.
__callStatic()  : mixed
Makes HTML tags available as static methods on the class.
__construct()  : mixed
Class constructor.
a()  :
a()  :
abbr()  :
abbr()  :
address()  :
address()  :
area()  :
area()  :
article()  :
article()  :
aside()  :
aside()  :
audio()  :
audio()  :
b()  :
b()  :
base()  :
base()  :
bdi()  :
bdi()  :
bdo()  :
bdo()  :
blockquote()  :
blockquote()  :
body()  :
body()  :
br()  :
br()  :
button()  :
button()  :
canvas()  :
canvas()  :
caption()  :
caption()  :
cite()  :
cite()  :
close()  : $this
Creates an HTML closing tag matching the last tag opened by `self::open()`.
code()  :
code()  :
col()  :
col()  :
colgroup()  :
colgroup()  :
comment()  : $this
Creates an HTML comment from the specified text and pass it to the buffer.
condition()  : $this
Takes a condition (some boolean value) to determine whether or not to create the very next element and pass it to the buffer.
data()  :
data()  :
datalist()  :
datalist()  :
dd()  :
dd()  :
del()  :
del()  :
details()  :
details()  :
dfn()  :
dfn()  :
dialog()  :
dialog()  :
div()  :
div()  :
dl()  :
dl()  :
dt()  :
dt()  :
echo()  : void
Echos the created HTML elements found in the buffer and empties it.
element()  : $this
Creates a complete HTML element (opening and closing tags) constructed from the specified parameters and pass it to the buffer.
em()  :
em()  :
embed()  :
embed()  :
entity()  : $this
Creates an HTML entity from the specified name and pass it to the buffer.
execute()  : $this
Takes a callback and executes it after binding $this (HTML) to it, useful for example to execute any PHP code while creating the markup.
fieldset()  :
fieldset()  :
figcaption()  :
figcaption()  :
figure()  :
figure()  :
footer()  :
footer()  :
form()  :
form()  :
h1()  :
h1()  :
h2()  :
h2()  :
h3()  :
h3()  :
h4()  :
h4()  :
h5()  :
h5()  :
h6()  :
h6()  :
head()  :
head()  :
header()  :
header()  :
hr()  :
hr()  :
html()  :
html()  :
i()  :
i()  :
iframe()  :
iframe()  :
img()  :
img()  :
input()  :
input()  :
ins()  :
ins()  :
kbd()  :
kbd()  :
label()  :
label()  :
legend()  :
legend()  :
li()  :
li()  :
link()  :
link()  :
main()  :
main()  :
map()  :
map()  :
mark()  :
mark()  :
meta()  :
meta()  :
meter()  :
meter()  :
minify()  : string
Minifies HTML buffers by removing all unnecessary whitespaces and comments.
nav()  :
nav()  :
node()  : $this
Creates an arbitrary text-node from the specified text and pass it to the buffer (useful to add some special tags, "\<!DOCTYPE html>" for example).
noscript()  :
noscript()  :
object()  :
object()  :
ol()  :
ol()  :
open()  : $this
Creates an HTML opening tag from the specified parameters and pass it to the buffer. Works in conjunction with `self::close()`.
optgroup()  :
optgroup()  :
option()  :
option()  :
output()  :
output()  :
p()  :
p()  :
param()  :
param()  :
picture()  :
picture()  :
pre()  :
pre()  :
progress()  :
progress()  :
q()  :
q()  :
return()  : string
Returns the created HTML elements found in the buffer and empties it.
rp()  :
rp()  :
rt()  :
rt()  :
ruby()  :
ruby()  :
s()  :
s()  :
samp()  :
samp()  :
script()  :
script()  :
section()  :
section()  :
select()  :
select()  :
small()  :
small()  :
source()  :
source()  :
span()  :
span()  :
strong()  :
strong()  :
style()  :
style()  :
sub()  :
sub()  :
summary()  :
summary()  :
sup()  :
sup()  :
svg()  :
svg()  :
table()  :
table()  :
tbody()  :
tbody()  :
td()  :
td()  :
template()  :
template()  :
textarea()  :
textarea()  :
tfoot()  :
tfoot()  :
th()  :
th()  :
thead()  :
thead()  :
time()  :
time()  :
title()  :
title()  :
tr()  :
tr()  :
track()  :
track()  :
u()  :
u()  :
ul()  :
ul()  :
var()  :
var()  :
video()  :
video()  :
wbr()  :
wbr()  :
agreeOrFail()  : void
Checks if the passed condition and throws exception if it's not truthy.
isConditionTruthy()  : bool
Determines whether or not the last set condition is truthy or falsy.
stringifyAttributes()  : string
Returns an HTML attributes string from an associative array of attributes.
translateElement()  : string
Replaces variables in the passed string with values with matching key from the passed array.
validate()  : void
Asserts that the passed HTML is valid.

Properties

$buffer

private array<string|int, mixed> $buffer

$conditions

private array<string|int, mixed> $conditions

$stack

private array<string|int, mixed> $stack

$validate

private bool $validate

Methods

__call()

Makes HTML tags available as methods on the class.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__callStatic()

Makes HTML tags available as static methods on the class.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

Class constructor.

public __construct([bool $validate = true ]) : mixed
Parameters
$validate : bool = true

Whether to validate the HTML upon return/echo or not.

Return values
mixed

a()

public static a(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

a()

public a(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

abbr()

public static abbr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

abbr()

public abbr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

address()

public static address(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

address()

public address(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

area()

public static area(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

area()

public area(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

article()

public static article(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

article()

public article(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

aside()

public static aside(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

aside()

public aside(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

audio()

public static audio(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

audio()

public audio(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

b()

public static b(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

b()

public b(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

base()

public static base(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

base()

public base(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

bdi()

public static bdi(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

bdi()

public bdi(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

bdo()

public static bdo(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

bdo()

public bdo(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

blockquote()

public blockquote(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

blockquote()

public static blockquote(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

body()

public static body(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

body()

public body(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

br()

public br(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

br()

public static br(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

button()

public static button(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

button()

public button(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

canvas()

public static canvas(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

canvas()

public canvas(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

caption()

public static caption(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

caption()

public caption(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

cite()

public cite(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

cite()

public static cite(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

close()

Creates an HTML closing tag matching the last tag opened by `self::open()`.

public close() : $this
Tags
throws
Exception

If no tag has been opened.

Return values
$this

code()

public static code(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

code()

public code(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

col()

public static col(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

col()

public col(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

colgroup()

public static colgroup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

colgroup()

public colgroup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

comment()

Creates an HTML comment from the specified text and pass it to the buffer.

public comment(string $text) : $this
Parameters
$text : string
Tags
throws
Exception

If the supplied text is invalid.

Return values
$this

condition()

Takes a condition (some boolean value) to determine whether or not to create the very next element and pass it to the buffer.

public condition(mixed $condition) : $this
Parameters
$condition : mixed

Any value that can be casted into a boolean.

Return values
$this

data()

public data(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

data()

public static data(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

datalist()

public static datalist(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

datalist()

public datalist(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dd()

public static dd(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dd()

public dd(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

del()

public static del(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

del()

public del(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

details()

public static details(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

details()

public details(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dfn()

public dfn(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dfn()

public static dfn(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dialog()

public dialog(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dialog()

public static dialog(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

div()

public div(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

div()

public static div(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dl()

public dl(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dl()

public static dl(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dt()

public dt(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

dt()

public static dt(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

echo()

Echos the created HTML elements found in the buffer and empties it.

public echo() : void
Tags
throws
Exception

If not all open elements are closed or the generated html is invalid.

Return values
void

element()

Creates a complete HTML element (opening and closing tags) constructed from the specified parameters and pass it to the buffer.

public element(string $name[, string|null $content = '' ][, array<string|int, string> $attributes = [] ]) : $this
Parameters
$name : string

A name of an HTML tag.

$content : string|null = ''

[optional] The text or html content of the element, passing null will make it a self-closing tag.

$attributes : array<string|int, string> = []

[optional] An associative array of attributes. To indicate a boolean-attribute (no-value-attribute), simply provide a key with value null or provide only a value without a key with the name of the attribute. As a shortcut, setting the value as false will exclude the attribute.

Tags
throws
Exception

If the supplied name is invalid.

Return values
$this

em()

public em(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

em()

public static em(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

embed()

public static embed(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

embed()

public embed(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

entity()

Creates an HTML entity from the specified name and pass it to the buffer.

public entity(string $name) : $this
Parameters
$name : string

The name of the HTML entity without & nor ;.

Tags
throws
Exception

If the supplied name is invalid.

Return values
$this

execute()

Takes a callback and executes it after binding $this (HTML) to it, useful for example to execute any PHP code while creating the markup.

public execute(callable $callback) : $this
Parameters
$callback : callable

The callback to call and bind $this to, this callback will also be passed the instance it was called on as the first parameter.

Return values
$this

fieldset()

public fieldset(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

fieldset()

public static fieldset(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

figcaption()

public static figcaption(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

figcaption()

public figcaption(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

figure()

public figure(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

figure()

public static figure(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values
public footer(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values
public static footer(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

form()

public static form(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

form()

public form(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h1()

public static h1(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h1()

public h1(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h2()

public static h2(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h2()

public h2(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h3()

public static h3(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h3()

public h3(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h4()

public static h4(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h4()

public h4(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h5()

public h5(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h5()

public static h5(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h6()

public static h6(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

h6()

public h6(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

head()

public static head(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

head()

public head(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

header()

public static header(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

header()

public header(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

hr()

public hr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

hr()

public static hr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

html()

public static html(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

html()

public html(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

i()

public static i(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

i()

public i(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

iframe()

public static iframe(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

iframe()

public iframe(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

img()

public static img(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

img()

public img(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

input()

public static input(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

input()

public input(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ins()

public static ins(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ins()

public ins(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

kbd()

public static kbd(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

kbd()

public kbd(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

label()

public label(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

label()

public static label(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

legend()

public legend(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

legend()

public static legend(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

li()

public li(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

li()

public static li(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values
public link(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values
public static link(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

main()

public main(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

main()

public static main(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

map()

public map(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

map()

public static map(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

mark()

public mark(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

mark()

public static mark(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

meta()

public meta(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

meta()

public static meta(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

meter()

public meter(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

meter()

public static meter(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

minify()

Minifies HTML buffers by removing all unnecessary whitespaces and comments.

public static minify(string $html) : string
Parameters
$html : string
Return values
string

nav()

public static nav(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

nav()

public nav(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

node()

Creates an arbitrary text-node from the specified text and pass it to the buffer (useful to add some special tags, "\<!DOCTYPE html>" for example).

public node(string $text) : $this
Parameters
$text : string

The text to pass to the buffer.

Tags
throws
Exception

If the supplied text is invalid.

Return values
$this

noscript()

public noscript(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

noscript()

public static noscript(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

object()

public static object(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

object()

public object(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ol()

public ol(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ol()

public static ol(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

open()

Creates an HTML opening tag from the specified parameters and pass it to the buffer. Works in conjunction with `self::close()`.

public open(string $name[, array<string|int, string> $attributes = [] ]) : $this
Parameters
$name : string

A name of an HTML tag.

$attributes : array<string|int, string> = []

[optional] An associative array of attributes. To indicate a boolean-attribute (no-value-attribute), simply provide a key with value null. Setting the value as false will exclude the attribute.

Tags
throws
Exception

If the supplied name is invalid.

Return values
$this

optgroup()

public static optgroup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

optgroup()

public optgroup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

option()

public static option(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

option()

public option(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

output()

public static output(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

output()

public output(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

p()

public static p(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

p()

public p(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

param()

public param(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

param()

public static param(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

picture()

public picture(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

picture()

public static picture(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

pre()

public static pre(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

pre()

public pre(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

progress()

public static progress(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

progress()

public progress(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

q()

public static q(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

q()

public q(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

return()

Returns the created HTML elements found in the buffer and empties it.

public return() : string
Tags
throws
Exception

If not all open elements are closed or the generated html is invalid.

Return values
string

rp()

public static rp(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

rp()

public rp(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

rt()

public rt(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

rt()

public static rt(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ruby()

public ruby(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ruby()

public static ruby(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

s()

public s(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

s()

public static s(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

samp()

public static samp(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

samp()

public samp(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

script()

public script(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

script()

public static script(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

section()

public section(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

section()

public static section(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

select()

public select(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

select()

public static select(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

small()

public small(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

small()

public static small(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

source()

public static source(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

source()

public source(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

span()

public static span(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

span()

public span(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

strong()

public static strong(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

strong()

public strong(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

style()

public static style(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

style()

public style(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

sub()

public static sub(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

sub()

public sub(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

summary()

public summary(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

summary()

public static summary(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

sup()

public static sup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

sup()

public sup(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

svg()

public svg(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

svg()

public static svg(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

table()

public table(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

table()

public static table(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tbody()

public tbody(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tbody()

public static tbody(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

td()

public static td(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

td()

public td(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

template()

public static template(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

template()

public template(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

textarea()

public static textarea(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

textarea()

public textarea(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tfoot()

public tfoot(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tfoot()

public static tfoot(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

th()

public th(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

th()

public static th(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

thead()

public thead(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

thead()

public static thead(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

time()

public time(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

time()

public static time(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

title()

public static title(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

title()

public title(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tr()

public tr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

tr()

public static tr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

track()

public static track(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

track()

public track(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

u()

public static u(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

u()

public u(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ul()

public static ul(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

ul()

public ul(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

var()

public var(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

var()

public static var(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

video()

public video(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

video()

public static video(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

wbr()

public wbr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

wbr()

public static wbr(string|null $content = '', array<string|int, mixed> $attributes = []) :
Parameters
$content = '' : string|null
$attributes = [] : array<string|int, mixed>
Return values

agreeOrFail()

Checks if the passed condition and throws exception if it's not truthy.

private agreeOrFail(bool $condition, string $message) : void

The message that is passed to this function should contain four %s placeholders for the class, function, file and line of the previous caller (offset 2 of the backtrace)

Parameters
$condition : bool
$message : string
Tags
throws
Exception
Return values
void

isConditionTruthy()

Determines whether or not the last set condition is truthy or falsy.

private isConditionTruthy(int $parent) : bool
Parameters
$parent : int

[optional] A flag to indicate condition depth [+1 = parentOpened, 0 = normal, -1 = parentClosed].

Return values
bool

The result of the current condition.

stringifyAttributes()

Returns an HTML attributes string from an associative array of attributes.

private stringifyAttributes(array<string|int, mixed> $attributes) : string
Parameters
$attributes : array<string|int, mixed>
Return values
string

translateElement()

Replaces variables in the passed string with values with matching key from the passed array.

private translateElement(string $text[, array<string|int, mixed> $variables = [] ]) : string
Parameters
$text : string

A string like {var} world!.

$variables : array<string|int, mixed> = []

An array like ['var' => 'Hello'].

Return values
string

A string like Hello world!

validate()

Asserts that the passed HTML is valid.

private validate(string $html) : void
Parameters
$html : string
Tags
throws
Exception

If the passed html is invalid.

Return values
void

Search results