Skip to content
PHP Ecosystem
Explore

ContentInterface

API reference › HTML Contracts › Element › ContentInterface

interfaceUIAwesome\Html\Contracts\Element\ContentInterface
Sourcesrc/Element/ContentInterface.php
Implemented by 2 types

Defines the contract for elements that accept child content.

Content appended through content() is encoded, whereas content appended through html() is preserved verbatim.

MethodDescriptionDefined by
content() abstractAppends encoded content.ContentInterface
getContent() abstractReturns the content assigned to the element.ContentInterface
html() abstractAppends trusted raw HTML content without encoding or sanitizing it.ContentInterface
abstract public function content(string|Stringable|UnitEnum ...$values): static

Appends encoded content.

Backed enums use their value (including 0); pure enums use their name. Values are normalized before encoding.

Parameters

ParameterTypeDescription
...$valuesstring|Stringable|UnitEnumContent to be encoded and appended.

Returns

static: New instance with appended encoded content.

abstract public function getContent(): string

Returns the content assigned to the element.

Returns

string: Content value assigned to the element. Never null.

abstract public function html(string|Stringable|UnitEnum ...$values): static

Appends trusted raw HTML content without encoding or sanitizing it.

Backed enums use their value (including 0); pure enums use their name.

Parameters

ParameterTypeDescription
...$valuesstring|Stringable|UnitEnumTrusted raw HTML content to be appended.

Returns

static: New instance with appended raw HTML content.