public function slugify($string, $options = null)
    {
        // BC: the second argument used to be the separator
        if (is_string($options)) {
            $separator            = $options;
            $options              = [];
            $options['separator'] = $separator;
        }

        $options = array_merge($this->options, (array) $options);

        // Add a custom ruleset without touching the default rules
        if (isset($options['ruleset'])) {
            $rules = array_merge($this->rules, $this->provider->getRules($options['ruleset']));
        } else {
            $rules = $this->rules;
        }

        $string = ($options['strip_tags'])
            ? strip_tags($string)
            : $string;

        $string = strtr($string, $rules);
        unset($rules);

        if ($options['lowercase'] && !$options['lowercase_after_regexp']) {
            $string = mb_strtolower($string);
        }

        $string = preg_replace($options['regexp'], $options['separator'], $string);

        if ($options['lowercase'] && $options['lowercase_after_regexp']) {
            $string = mb_strtolower($string);
        }

        return ($options['trim'])
            ? trim($string, $options['separator'])
            : $string;
    }
public function slugify($string, $options = null)
    {
        // BC: the second argument used to be the separator
        if (is_string($options)) {
            $separator            = $options;
            $options              = [];
            $options['separator'] = $separator;
        }

        $options = array_merge($this->options, (array) $options);

        // Add a custom ruleset without touching the default rules
        if (isset($options['ruleset'])) {
            $rules = array_merge($this->rules, $this->provider->getRules($options['ruleset']));
        } else {
            $rules = $this->rules;
        }

        $string = ($options['strip_tags'])
            ? strip_tags($string)
            : $string;

        $string = strtr($string, $rules);
        unset($rules);

        if ($options['lowercase'] && !$options['lowercase_after_regexp']) {
            $string = mb_strtolower($string);
        }

        $string = preg_replace($options['regexp'], $options['separator'], $string);

        if ($options['lowercase'] && $options['lowercase_after_regexp']) {
            $string = mb_strtolower($string);
        }

        return ($options['trim'])
            ? trim($string, $options['separator'])
            : $string;
    }
public function slugify ( $ string , $ options = null ) { // BC: the second argument used to be the separator if ( is_string ( $ options ) ) { $ separator = $ options ; $ options = [ ] ; $ options [ 'separator' ] = $ separator ; } $ options = array_merge ( $ this -> options , ( array ) $ options ) ; // Add a custom ruleset without touching the default rules if ( isset ( $ options [ 'ruleset' ] ) ) { $ rules = array_merge ( $ this -> rules , $ this -> provider -> getRules ( $ options [ 'ruleset' ] ) ) ; } else { $ rules = $ this -> rules ; } $ string = ( $ options [ 'strip_tags' ] ) ? strip_tags ( $ string ) : $ string ; $ string = strtr ( $ string , $ rules ) ; unset ( $ rules ) ; if ( $ options [ 'lowercase' ] && ! $ options [ 'lowercase_after_regexp' ] ) { $ string = mb_strtolower ( $ string ) ; } $ string = preg_replace ( $ options [ 'regexp' ] , $ options [ 'separator' ] , $ string ) ; if ( $ options [ 'lowercase' ] && $ options [ 'lowercase_after_regexp' ] ) { $ string = mb_strtolower ( $ string ) ; } return ( $ options [ 'trim' ] ) ? trim ( $ string , $ options [ 'separator' ] ) : $ string ; }
Returns the slug-version of the string.

@param string            $string  String to slugify
@param string|array|null $options Options

@return string Slugified version of the string
Returns the slug - version of the string .