Caelrik\Ui\Support
Arr
final class Caelrik\Ui\Support\Arr
Dot-notation helpers for row arrays (user.name reads $row['user']['name']).
Methods
get
static get(array $row, string $path): mixedset
static set(array $row, string $path, mixed $value): voidtoText
static toText(mixed $value): stringConverts a cell value to display text.
Dates
final class Caelrik\Ui\Support\Dates
Strict ISO 8601 date parsing for values coming from requests and databases.
Only 2026-11-05, 2026-11-05T14:30, 2026-11-05 14:30:00 and the same with seconds, fractions and a Z / +01:00 offset are accepted: PHP's relative formats ("next monday") never are.
Methods
parse
static parse(mixed $value, ?DateTimeZone $timeZone = null): DateTimeImmutableisDateOnly
static isDateOnly(mixed $value): boolEditorHtml
final class Caelrik\Ui\Support\EditorHtml
Server-side cleaning of rich text editor output (Field::editor()).
The browser can send any HTML, whatever the editor allows, so sanitize before storing or displaying it. The default configuration allows exactly what the Caelrik toolbars produce. Requires symfony/html-sanitizer (composer require symfony/html-sanitizer).
Methods
sanitize
static sanitize(string $html, ?HtmlSanitizerConfig $config = null): stringconfig
static config(): HtmlSanitizerConfigParagraphs, headings (h2-h4), bold, italic, underline, strike, lists, quotes, code, and http(s)/mailto links (forced to rel="noopener noreferrer nofollow").
Html
final class Caelrik\Ui\Support\Html
Minimal, escaping-by-default HTML builder used by every component.
Methods
escape
static escape(string|int|float|null $value): stringattributes
static attributes(array $attributes): stringRenders an attribute list. true renders a boolean attribute, null and false skip it.
tag
static tag(string $name, array $attributes = [], ?string $content = null): stringRenders an element. $content is inserted as-is: escape it before passing user data.
raw
static raw(string $html): RawHtmlMarks markup as trusted, so content-accepting components insert it unescaped.
content
static content(Stringable|string $content): stringContent for Modal and Tabs: a string is escaped text, a Stringable (a component, Html::raw(), Laravel's HtmlString, Twig's Markup) is inserted as HTML.
classes
static classes(array $classes): ?stringJoins CSS classes, dropping empty entries and duplicates.
QrMatrix
final class Caelrik\Ui\Support\QrMatrix
A QR code encoder (ISO/IEC 18004, model 2, versions 1 to 40): the text is encoded as one segment (numeric, alphanumeric or UTF-8 bytes, whichever is shortest) in the smallest version that holds it, with Reed-Solomon error correction and the mask of the lowest penalty. It follows the structure of Project Nayuki's QR Code generator (MIT).
QrMatrix::encode('https://example.com', 'M'); // list of rows of booleans (true = dark)Constants
| Constant | Value |
|---|---|
LEVELS | ['L', 'M', 'Q', 'H'] |
Methods
encode
static encode(string $text, string $level = 'M', ?int $version = null, ?int $mask = null): arrayThe modules of the QR code of $text, row by row (true = dark), without the quiet zone.
$version: a fixed version (1 to 40); by default the smallest that holds the text$mask: a fixed mask (0 to 7); by default the one of the lowest penalty- Throws LengthException when the text is too long for a QR code at this level
RawHtml
final class Caelrik\Ui\Support\RawHtml implements Stringable
Trusted HTML, inserted as-is where components accept content (Modal, Tabs). Create it with Html::raw() only for markup you control or have sanitized.
Methods
__construct
__construct(string $html)Url
final class Caelrik\Ui\Support\Url
URLs from data, made safe for href and src.
Methods
safe
static safe(string $url): ?stringA relative, http or https URL, or null (javascript:, data: and other schemes are dropped).
The scheme is read as browsers read it: the letters before the first colon, when no "/", "?" or "#" comes first. PHP's parse_url() reads "javascript:0" as a host and a port, so it is not used.