Html
HTML-escaping helpers shared by every renderer and the template engine in this package: safe attribute-string assembly and a single escaping primitive both are built on.
Html::attrs()
public static function attrs(array $attributes): stringRenders `$attributes` as a space-joined, HTML-escaped attribute string. A `null` or `false` value omits the attribute entirely; `true` emits the bare attribute name (a boolean HTML attribute, e.g. `required`); any other value is escaped and quoted.
Parameters
| Name | Type | Description |
|---|---|---|
| $attributes | array<string, (string | null | bool | int | float)> |
Html::escape()
public static function escape(string $value): stringHTML-escapes `$value` for safe interpolation into markup: quotes, ampersands, and angle brackets are all escaped (`ENT_QUOTES`), and an invalid UTF-8 byte sequence is substituted rather than aborting (`ENT_SUBSTITUTE`).
Parameters
| Name | Type | Description |
|---|---|---|
| $value | string |