str_camel(string $s): string Converts a string to camelCase. Handles spaces, hyphens, underscores, punctuation, and acronyms (e.g., "XMLHttpRequest" -> "xmlHttpRequest").
str_pascal(string $s): string Converts a string to PascalCase.
str_snake(string $s): string Converts a string to snake_case.
str_kebab(string $s): string Converts a string to kebab-case.
str_slug(string $s, string $separator = "-"): string Converts a string into a lowercase URL-friendly slug joined by $separator. Throws an Exception if $separator is empty.
Truncation, Padding & Wrapping
str_truncate(string $s, int $maxLen, string $suffix = "..."): string Truncates $s to at most $maxLen characters, appending $suffix when truncated. If $maxLen is smaller than or equal to strlen($suffix), returns substr($suffix, 0, $maxLen). Throws an Exception if $maxLen < 0.
str_pad_left(string $s, int $length, string $pad = " "): string Pads $s on the left with $pad until its length is at least $length. Throws an Exception if $length < 0 or $pad is empty.
str_pad_right(string $s, int $length, string $pad = " "): string Pads $s on the right with $pad until its length is at least $length. Throws an Exception if $length < 0 or $pad is empty.
str_wrap(string $s, int $width, string $break = "\n"): string Word-wraps $s so each line is at most $width characters, joining lines with $break. Words longer than $width are split across lines. Preserves existing \n paragraph breaks. Throws an Exception if $width <= 0.
Inspection & Transformation
str_starts_with(string $s, string $prefix): bool Returns true if $s starts with $prefix (always true for empty $prefix).
str_ends_with(string $s, string $suffix): bool Returns true if $s ends with $suffix (always true for empty $suffix).
str_contains(string $s, string $needle): bool Returns true if $s contains $needle (always true for empty $needle).
str_reverse(string $s): string Returns $s with its characters in reverse order.
Error Handling
All invalid arguments throw Exception with a clear str: ... message: