Skip to content

Kirby 5.6.4

Str::slug()

Convert a string to a safe version to be used in a URL

Str::slug(string $string, string $separator = null, string $allowed = null, int $maxlength = 128, bool $language = true): string

Parameters

Name Type Default Description
$stringrequired string no default value The unsafe string
$separator string null To be used instead of space and
other non-word characters.
$allowed string null List of all allowed characters (regex)
$maxlength int 128 The maximum length of the slug
$language bool true Whether to apply the language-specific rules

Return type

string

The safe string

Parent class

Kirby\Toolkit\Str