src/Inflector.php
public static function slug($string, $replacement = '-')
    {
        $transliterated = static::transliterate($string);
        $spaced = preg_replace('/[^\w\s]/', ' ', $transliterated);
        return preg_replace('/\\s+/', $replacement, trim($spaced));
    }
public static function slug($string, $replacement = '-')
    {
        $transliterated = static::transliterate($string);
        $spaced = preg_replace('/[^\w\s]/', ' ', $transliterated);
        return preg_replace('/\\s+/', $replacement, trim($spaced));
    }
public static function slug ( $ string , $ replacement = '-' ) { $ transliterated = static :: transliterate ( $ string ) ; $ spaced = preg_replace ( '/[^\w\s]/' , ' ' , $ transliterated ) ; return preg_replace ( '/\\s+/' , $ replacement , trim ( $ spaced ) ) ; }
Returns a string with all spaces converted to given replacement and non word characters removed.
Maps special characters to ASCII using `transliterator_transliterate`.

@param  string $string      An arbitrary string to convert.
@param  string $replacement The replacement to use for spaces.
@return string              The converted string.
Returns a string with all spaces converted to given replacement and non word characters removed . Maps special characters to ASCII using transliterator_transliterate .