TagRenderer
class TagRenderer
Methods
Create the tag renderer.
Get a renderer that stamps tags with data-inertia ownership attributes.
Render an escaped title tag.
Render a meta tag keyed by the given attribute ("name" or "property").
Render a meta tag keyed by the given attribute ("name" or "property") with arbitrary attributes.
Render a link tag.
Render a link tag with arbitrary attributes.
Render structured data with script-safe JSON encoding.
Render escaped HTML attributes.
Attribute names aren't HTML-escaped, so reject anything that could break out of the attribute position. The "u" modifier also makes invalid UTF-8 fail the match.
Generate a stable, content-derived data-inertia key for a tag.
Validate and escape the combined attribute sets.
Render a void HTML element.
Render an HTML element with content.
Render attributes with their leading separator.
Get the ownership attribute when Inertia rendering is enabled.
Details
at line 14
__construct(bool $withInertiaAttributes = false)
Create the tag renderer.
at line 21
TagRenderer
withInertiaAttributes()
Get a renderer that stamps tags with data-inertia ownership attributes.
at line 29
string
title(string $title, string|null $inertiaKey = null)
Render an escaped title tag.
at line 39
string
meta(string $attribute, string $key, string|int|float|bool $content, string|null $inertiaKey = null)
Render a meta tag keyed by the given attribute ("name" or "property").
at line 51
string
metaWithAttributes(string $attribute, string $key, array $attributes, string|null $inertiaKey = null)
Render a meta tag keyed by the given attribute ("name" or "property") with arbitrary attributes.
at line 66
string
link(string $rel, string $href, string|null $inertiaKey = null)
Render a link tag.
at line 82
string
linkWithAttributes(string $rel, array $attributes, string|null $inertiaKey = null)
Render a link tag with arbitrary attributes.
at line 99
string
jsonLd(array $schema, string|null $inertiaKey = null)
Render structured data with script-safe JSON encoding.
at line 117
string
attributes(array $attributes)
Render escaped HTML attributes.
at line 127
protected bool
isValidAttributeName(string $name)
Attribute names aren't HTML-escaped, so reject anything that could break out of the attribute position. The "u" modifier also makes invalid UTF-8 fail the match.
at line 135
string
stableKey(string $prefix, string $value)
Generate a stable, content-derived data-inertia key for a tag.
at line 145
protected string
renderAttributes(array ...$attributeSets)
Validate and escape the combined attribute sets.
at line 183
protected string
voidElement(string $name, array ...$attributeSets)
Render a void HTML element.
at line 193
protected string
element(string $name, string $content, array ...$attributeSets)
Render an HTML element with content.
at line 203
protected string
renderedAttributes(array ...$attributeSets)
Render attributes with their leading separator.
at line 215
protected array
inertiaAttributes(string|null $key)
Get the ownership attribute when Inertia rendering is enabled.