yii\helpers\BaseInflector::slug PHP Method

slug() public static method

If intl extension isn't available uses fallback that converts latin characters only and removes the rest. You may customize characters map via $transliteration property of the helper.
public static slug ( string $string, string $replacement = '-', boolean $lowercase = true ) : string
$string string An arbitrary string to convert
$replacement string The replacement to use for spaces
$lowercase boolean whether to return the string in lowercase or not. Defaults to `true`.
return string The converted string.
    public static function slug($string, $replacement = '-', $lowercase = true)
    {
        $string = static::transliterate($string);
        $string = preg_replace('/[^a-zA-Z0-9=\\sā€”ā€“-]+/u', '', $string);
        $string = preg_replace('/[=\\sā€”ā€“-]+/u', $replacement, $string);
        $string = trim($string, $replacement);
        return $lowercase ? strtolower($string) : $string;
    }