Core classCoredna\Kernel\Helper

Str

Helper for string manipulation — case conversion, slugs, ASCII folding, URL-safe base64, HTML-safe JSON, and loose-boolean parsing.

Coredna\Kernel\Helper\Str

Methods 7

Take arguments. The API serialises only getters that need none.

# toBool(string $value)
?bool
Normalizes a loosely typed string to a strict boolean. "1"/"true"/"yes"/"on" become true; "0"/"false"/"no"/"off" (and an empty string) become false; anything else — including "null" — becomes null, so the caller can decide what to do with an unrecognized value.
# slugify(string $string, string $separator)
string
Create a URL-friendly slug from a string.
# camelCaseToWords(string $string, string $wordDelimiter)
string
Transform a camelCased string into capitalized, space-separated words (e.g. "siteData" becomes "Site Data").
# foldToAscii(string $string)
string
Fold accented Latin characters to their plain ASCII equivalent (é becomes e, ø becomes o, æ becomes ae), leaving non-Latin scripts untouched. Mirrors Elasticsearch's asciifolding token filter.
# base64UrlEncode(string $string)
string
Encode a string to Base64URL, which is safe to use in URLs.
# base64UrlDecode(string $encodedString)
string
Decode a Base64URL-encoded string. Also available in Smarty as the base64url_decode modifier.
# getHtmlSafeJson(array $array)
string
Encode an array to JSON and convert special characters to HTML entities, so the result is safe to embed in HTML.