Appearance
String Helpers
Toolbelt provides a wide number of Twig filters and functions for manipulating strings.
Wrapped PHP Functions
The following functions/filters are wrappers for PHP native functions:
Twig name | Available in Twig as | Wrapped function / signature | Docs |
---|---|---|---|
parse_url | function | parse_url(string $url, int $component = -1): int|string|array|null|false | 🔗 |
dirname | function | dirname(string $path, int $levels = 1): string | 🔗 |
pathinfo | function | pathinfo(string $path, int $flags = PATHINFO_ALL): array|string | 🔗 |
md5 | function , filter | md5(string $string, bool $binary = false) | 🔗 |
Wrapped craft\helpers\StringHelper
Functions
The following functions/filters are wrappers for functions in Craft's craft\helpers\StringHelper
class:
Twig name | Available in Twig as | Wrapped method / signature | Docs |
---|---|---|---|
UUID | function | UUID(): string | 🔗 |
basename | function , filter | basename(string $path, string $suffix = ''): string | 🔗 |
humanize | function , filter | humanize(string $str): string | 🔗 |
slugify | function , filter | slugify(string $str, string $replacement = '-', ?string $language = null): string | 🔗 |
titleize | function , filter | titleize(string $str, ?[] $ignore = null): string | 🔗 |
titleizeForHumans | function , filter | titleizeForHumans(string $str, ?[] $ignore = null): string | 🔗 |
Extra String Helpers
The following functions/filters are custom to Toolbelt:
Twig name | Available in Twig as | Signature | Docs |
---|---|---|---|
stringify() , s() | function , filter | stringify(string $str): \Stringy\Stringy | Converts a string to a Stringy instance |