Tools.php
public static function linkRewrite($str, $allowUnicodeChars = false)
    {
        if (!\is_string($str)) {
            return false;
        }

        $str = trim($str);

        if (\function_exists('mb_strtolower')) {
            $str = mb_strtolower($str, 'utf-8');
        }
        if (!$allowUnicodeChars) {
            $str = self::replaceAccentedChars($str);
        }

        // Remove all non-whitelist chars.
        if ($allowUnicodeChars) {
            $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]\-\pL]/u', '', $str);
        } else {
            $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]\-]/', '', $str);
        }

        $str = preg_replace('/[\s\'\:\/\[\]\-]+/', ' ', $str);
        $str = str_replace([' ', '/'], '-', $str);

        // If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
        // This way we lose fewer special chars.
        if (!\function_exists('mb_strtolower')) {
            $str = strtolower($str);
        }

        return $str;
    }
public static function linkRewrite($str, $allowUnicodeChars = false)
    {
        if (!\is_string($str)) {
            return false;
        }

        $str = trim($str);

        if (\function_exists('mb_strtolower')) {
            $str = mb_strtolower($str, 'utf-8');
        }
        if (!$allowUnicodeChars) {
            $str = self::replaceAccentedChars($str);
        }

        // Remove all non-whitelist chars.
        if ($allowUnicodeChars) {
            $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]\-\pL]/u', '', $str);
        } else {
            $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]\-]/', '', $str);
        }

        $str = preg_replace('/[\s\'\:\/\[\]\-]+/', ' ', $str);
        $str = str_replace([' ', '/'], '-', $str);

        // If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
        // This way we lose fewer special chars.
        if (!\function_exists('mb_strtolower')) {
            $str = strtolower($str);
        }

        return $str;
    }
Return a friendly url made from the provided string

@param string $str Input string
@param bool $allowUnicodeChars If unicode characters are allowed in URL
@return string Link rewrite