Skip to content
PHP Ecosystem
Explore

HasCharset

API reference › HTML Attribute › HasCharset

traitUIAwesome\Html\Attribute\HasCharset
Sourcesrc/HasCharset.php
Used by 1 type

Provides an immutable API for the charset attribute.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta#charset.

MethodDescriptionDefined by
charset()Sets the charset attribute.HasCharset
public function charset(string|Stringable|UnitEnum|null $value): static

Sets the charset attribute.

Declares the document character encoding.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullCharacter encoding token, or null to remove the attribute.

Returns

static: New instance with the updated charset attribute. Charset for predefined enum values.

Throws