public function slug($separator = '-')
    {
        $str = $this->toAscii();

        $flip = $separator == '-' ? '_' : '-';
        $str = str_replace('.', $separator, $str);
        $str = preg_replace('!['.preg_quote($flip).']+!u', $separator, $str);
        $str = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($str));
        $str = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $str);

        return trim($str, $separator);
    }
public function slug($separator = '-')
    {
        $str = $this->toAscii();

        $flip = $separator == '-' ? '_' : '-';
        $str = str_replace('.', $separator, $str);
        $str = preg_replace('!['.preg_quote($flip).']+!u', $separator, $str);
        $str = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($str));
        $str = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $str);

        return trim($str, $separator);
    }
public function slug ( $ separator = '-' ) { $ str = $ this -> toAscii ( ) ; $ flip = $ separator == '-' ? '_' : '-' ; $ str = str_replace ( '.' , $ separator , $ str ) ; $ str = preg_replace ( '![' . preg_quote ( $ flip ) . ']+!u' , $ separator , $ str ) ; $ str = preg_replace ( '![^' . preg_quote ( $ separator ) . '\pL\pN\s]+!u' , '' , mb_strtolower ( $ str ) ) ; $ str = preg_replace ( '![' . preg_quote ( $ separator ) . '\s]+!u' , $ separator , $ str ) ; return trim ( $ str , $ separator ) ; }
Generate a URL friendly "slug".

@param string $separator

@return string
Generate a URL friendly slug .