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, array|string $files, array $attributes)

Helper method for building media tags.

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

Creates audio tag with support for multiple sources.

string
video(array|string $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 33
static addMethod(string $methodName, Closure $closure)

Adds a method to the class.

Parameters

string $methodName Method name
Closure $closure Closure

in ExtendableTrait at line 45
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 62
static mixed __callStatic(string $name, array $arguments)

Executes class extensions.

Parameters

string $name Method name
array $arguments Method arguments

Return Value

mixed

at line 34
__construct(bool $xhtml = false)

Constructor.

Parameters

bool $xhtml Should we return HXML?

at line 45
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 70
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 83
protected string buildMedia(string $type, array|string $files, array $attributes)

Helper method for building media tags.

Parameters

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

Return Value

string

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

Creates audio tag with support for multiple sources.

Parameters

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

Return Value

string

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

Creates video tag with support for multiple sources.

Parameters

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

Return Value

string

at line 127
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 153
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 165
string ol(array $items, array $attributes = [])

Builds am ordered list.

Parameters

array $items List items
array $attributes List attributes

Return Value

string