class HTML

HTML helper.

Traits

Extendable trait.

Properties

static protected array $_extensions Class extensions. from ExtendableTrait
protected bool $xhtml Should we return XHTML?

Methods

static 
addMethod(string $methodName, Closure $closure)

Adds a method to the class.

mixed
__call(string $name, array $arguments)

Executes class extensions.

static mixed
__callStatic(string $name, array $arguments)

Executes class extensions.

__construct(bool $xhtml = false)

Constructor.

string
attributes(array $attributes)

Takes an array of attributes and turns it into a string.

string
tag(string $name, array $attributes = [], string|null $content = null)

Creates a HTML5 tag.

string
buildMedia(string $type, string|array $files, array $attributes)

Helper method for building media tags.

string
audio(string|array $files, array $attributes = [])

Creates audio tag with support for multiple sources.

string
video(string|array $files, array $attributes = [])

Creates video tag with support for multiple sources.

string
buildList(string $type, array $items, array $attributes)

Helper method for building list tags.

string
ul(array $items, array $attributes = [])

Builds an un-ordered list.

string
ol(array $items, array $attributes = [])

Builds am ordered list.

Details

in ExtendableTrait at line 35
static addMethod(string $methodName, Closure $closure)

Adds a method to the class.

Parameters

string $methodName Method name
Closure $closure Closure

in ExtendableTrait at line 47
mixed __call(string $name, array $arguments)

Executes class extensions.

Parameters

string $name Method name
array $arguments Method arguments

Return Value

mixed

in ExtendableTrait at line 64
static mixed __callStatic(string $name, array $arguments)

Executes class extensions.

Parameters

string $name Method name
array $arguments Method arguments

Return Value

mixed

at line 36
__construct(bool $xhtml = false)

Constructor.

Parameters

bool $xhtml Should we return HXML?

at line 47
protected string attributes(array $attributes)

Takes an array of attributes and turns it into a string.

Parameters

array $attributes Array of tags

Return Value

string

at line 72
string tag(string $name, array $attributes = [], string|null $content = null)

Creates a HTML5 tag.

Parameters

string $name Tag name
array $attributes Tag attributes
string|null $content Tag content

Return Value

string

at line 85
protected string buildMedia(string $type, string|array $files, array $attributes)

Helper method for building media tags.

Parameters

string $type Tag type
string|array $files File or array of files
array $attributes Tag attributes

Return Value

string

at line 104
string audio(string|array $files, array $attributes = [])

Creates audio tag with support for multiple sources.

Parameters

string|array $files File or array of files
array $attributes Tag attributes

Return Value

string

at line 116
string video(string|array $files, array $attributes = [])

Creates video tag with support for multiple sources.

Parameters

string|array $files File or array of files
array $attributes Tag attributes

Return Value

string

at line 129
protected string buildList(string $type, array $items, array $attributes)

Helper method for building list tags.

Parameters

string $type Tag type
array $items List items
array $attributes Tag attributes

Return Value

string

at line 155
string ul(array $items, array $attributes = [])

Builds an un-ordered list.

Parameters

array $items List items
array $attributes List attributes

Return Value

string

at line 167
string ol(array $items, array $attributes = [])

Builds am ordered list.

Parameters

array $items List items
array $attributes List attributes

Return Value

string