Skip to content

Kirby 6.0.0

Str::slug()

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

Str::slug(string|null $string, string|null $separator = null, string|null $allowed = null, non-negative-int|false $maxlength = 128, bool $language = true): string

Parameters

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

Return type

string

Parent class

Kirby\Toolkit\Str