Skip to content
PHP Ecosystem
Explore

Html

API reference › HTML › Html

final classUIAwesome\Html\Html
Sourcesrc/Html.php

Provides curated static factory methods for the most commonly used HTML elements.

Every factory returns a fluent element instance; Html::el() renders a one-off element string instead.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements (Html for the low-level tag renderers.).

MethodDescriptionDefined by
a() staticReturns a new A instance for the HTML <a> element.Html
article() staticReturns a new Article instance for the HTML <article> element.Html
button() staticReturns a new Button instance for the HTML <button> element.Html
div() staticReturns a new Div instance for the HTML <div> element.Html
el() staticReturns a rendered HTML element string for a one-off tag.Html
em() staticReturns a new Em instance for the HTML <em> element.Html
footer() staticReturns a new Footer instance for the HTML <footer> element.Html
form() staticReturns a new Form instance for the HTML <form> element.Html
h1() staticReturns a new H1 instance for the HTML <h1> element.Html
h2() staticReturns a new H2 instance for the HTML <h2> element.Html
h3() staticReturns a new H3 instance for the HTML <h3> element.Html
h4() staticReturns a new H4 instance for the HTML <h4> element.Html
h5() staticReturns a new H5 instance for the HTML <h5> element.Html
h6() staticReturns a new H6 instance for the HTML <h6> element.Html
header() staticReturns a new Header instance for the HTML <header> element.Html
hr() staticReturns a new Hr instance for the HTML <hr> element.Html
i() staticReturns a new I instance for the HTML <i> element.Html
img() staticReturns a new Img instance for the HTML <img> element.Html
label() staticReturns a new Label instance for the HTML <label> element.Html
li() staticReturns a new Li instance for the HTML <li> element.Html
main() staticReturns a new Main instance for the HTML <main> element.Html
nav() staticReturns a new Nav instance for the HTML <nav> element.Html
ol() staticReturns a new Ol instance for the HTML <ol> element.Html
option() staticReturns a new Option instance for the HTML <option> element.Html
p() staticReturns a new P instance for the HTML <p> element.Html
section() staticReturns a new Section instance for the HTML <section> element.Html
select() staticReturns a new Select instance for the HTML <select> element.Html
span() staticReturns a new Span instance for the HTML <span> element.Html
strong() staticReturns a new Strong instance for the HTML <strong> element.Html
table() staticReturns a new Table instance for the HTML <table> element.Html
td() staticReturns a new Td instance for the HTML <td> element.Html
textarea() staticReturns a new TextArea instance for the HTML <textarea> element.Html
th() staticReturns a new Th instance for the HTML <th> element.Html
tr() staticReturns a new Tr instance for the HTML <tr> element.Html
ul() staticReturns a new Ul instance for the HTML <ul> element.Html
public static function a(): UIAwesome\Html\Palpable\A

Returns a new A instance for the HTML <a> element.

Returns

UIAwesome\Html\Palpable\A: New <a> element instance.

public static function article(): UIAwesome\Html\Sectioning\Article

Returns a new Article instance for the HTML <article> element.

Returns

UIAwesome\Html\Sectioning\Article: New <article> element instance.

public static function button(): UIAwesome\Html\Form\Button

Returns a new Button instance for the HTML <button> element.

Returns

UIAwesome\Html\Form\Button: New <button> element instance.

public static function div(): UIAwesome\Html\Flow\Div

Returns a new Div instance for the HTML <div> element.

Returns

UIAwesome\Html\Flow\Div: New <div> element instance.

public static function el(string $tag, mixed[] $attributes = [], string|Stringable $content = ''): string

Returns a rendered HTML element string for a one-off tag.

Resolves the tag kind from the library tag enumerations and dispatches to the matching renderer: void tags render without content, inline tags render without surrounding line breaks, and every other tag renders as a block.

Content is encoded with Encode::content() and attribute values with Encode::value(), so untrusted input never reaches the output unescaped.

Parameters

ParameterTypeDescription
$tagstringTag name to render.
$attributesmixed[]Associative array of HTML attributes.
$contentstring|StringableContent to be rendered inside the tag. Ignored for void tags.

Returns

string: Rendered HTML element string.

Throws

public static function em(): UIAwesome\Html\Phrasing\Em

Returns a new Em instance for the HTML <em> element.

Returns

UIAwesome\Html\Phrasing\Em: New <em> element instance.

public static function footer(): UIAwesome\Html\Root\Footer

Returns a new Footer instance for the HTML <footer> element.

Returns

UIAwesome\Html\Root\Footer: New <footer> element instance.

public static function form(): UIAwesome\Html\Form\Form

Returns a new Form instance for the HTML <form> element.

Returns

UIAwesome\Html\Form\Form: New <form> element instance.

public static function h1(): UIAwesome\Html\Heading\H1

Returns a new H1 instance for the HTML <h1> element.

Returns

UIAwesome\Html\Heading\H1: New <h1> element instance.

public static function h2(): UIAwesome\Html\Heading\H2

Returns a new H2 instance for the HTML <h2> element.

Returns

UIAwesome\Html\Heading\H2: New <h2> element instance.

public static function h3(): UIAwesome\Html\Heading\H3

Returns a new H3 instance for the HTML <h3> element.

Returns

UIAwesome\Html\Heading\H3: New <h3> element instance.

public static function h4(): UIAwesome\Html\Heading\H4

Returns a new H4 instance for the HTML <h4> element.

Returns

UIAwesome\Html\Heading\H4: New <h4> element instance.

public static function h5(): UIAwesome\Html\Heading\H5

Returns a new H5 instance for the HTML <h5> element.

Returns

UIAwesome\Html\Heading\H5: New <h5> element instance.

public static function h6(): UIAwesome\Html\Heading\H6

Returns a new H6 instance for the HTML <h6> element.

Returns

UIAwesome\Html\Heading\H6: New <h6> element instance.

public static function header(): UIAwesome\Html\Root\Header

Returns a new Header instance for the HTML <header> element.

Returns

UIAwesome\Html\Root\Header: New <header> element instance.

public static function hr(): UIAwesome\Html\Flow\Hr

Returns a new Hr instance for the HTML <hr> element.

Returns

UIAwesome\Html\Flow\Hr: New <hr> element instance.

public static function i(): UIAwesome\Html\Phrasing\I

Returns a new I instance for the HTML <i> element.

Returns

UIAwesome\Html\Phrasing\I: New <i> element instance.

public static function img(): UIAwesome\Html\Embedded\Img

Returns a new Img instance for the HTML <img> element.

Returns

UIAwesome\Html\Embedded\Img: New <img> element instance.

public static function label(): UIAwesome\Html\Phrasing\Label

Returns a new Label instance for the HTML <label> element.

Returns

UIAwesome\Html\Phrasing\Label: New <label> element instance.

public static function li(): UIAwesome\Html\List\Li

Returns a new Li instance for the HTML <li> element.

Returns

UIAwesome\Html\List\Li: New <li> element instance.

public static function main(): UIAwesome\Html\Flow\Main

Returns a new Main instance for the HTML <main> element.

Returns

UIAwesome\Html\Flow\Main: New <main> element instance.

public static function nav(): UIAwesome\Html\Sectioning\Nav

Returns a new Nav instance for the HTML <nav> element.

Returns

UIAwesome\Html\Sectioning\Nav: New <nav> element instance.

public static function ol(): UIAwesome\Html\List\Ol

Returns a new Ol instance for the HTML <ol> element.

Returns

UIAwesome\Html\List\Ol: New <ol> element instance.

public static function option(): UIAwesome\Html\Form\Option

Returns a new Option instance for the HTML <option> element.

Returns

UIAwesome\Html\Form\Option: New <option> element instance.

public static function p(): UIAwesome\Html\Flow\P

Returns a new P instance for the HTML <p> element.

Returns

UIAwesome\Html\Flow\P: New <p> element instance.

public static function section(): UIAwesome\Html\Sectioning\Section

Returns a new Section instance for the HTML <section> element.

Returns

UIAwesome\Html\Sectioning\Section: New <section> element instance.

public static function select(): UIAwesome\Html\Form\Select

Returns a new Select instance for the HTML <select> element.

Returns

UIAwesome\Html\Form\Select: New <select> element instance.

public static function span(): UIAwesome\Html\Phrasing\Span

Returns a new Span instance for the HTML <span> element.

Returns

UIAwesome\Html\Phrasing\Span: New <span> element instance.

public static function strong(): UIAwesome\Html\Phrasing\Strong

Returns a new Strong instance for the HTML <strong> element.

Returns

UIAwesome\Html\Phrasing\Strong: New <strong> element instance.

public static function table(): UIAwesome\Html\Table\Table

Returns a new Table instance for the HTML <table> element.

Returns

UIAwesome\Html\Table\Table: New <table> element instance.

public static function td(): UIAwesome\Html\Table\Td

Returns a new Td instance for the HTML <td> element.

Returns

UIAwesome\Html\Table\Td: New <td> element instance.

public static function textarea(): UIAwesome\Html\Form\TextArea

Returns a new TextArea instance for the HTML <textarea> element.

Returns

UIAwesome\Html\Form\TextArea: New <textarea> element instance.

public static function th(): UIAwesome\Html\Table\Th

Returns a new Th instance for the HTML <th> element.

Returns

UIAwesome\Html\Table\Th: New <th> element instance.

public static function tr(): UIAwesome\Html\Table\Tr

Returns a new Tr instance for the HTML <tr> element.

Returns

UIAwesome\Html\Table\Tr: New <tr> element instance.

public static function ul(): UIAwesome\Html\List\Ul

Returns a new Ul instance for the HTML <ul> element.

Returns

UIAwesome\Html\List\Ul: New <ul> element instance.