public static function slugify($string)
    {
        if (!is_string($string)) {
            $type = gettype($string);
            throw new \InvalidArgumentException("Given argument is a $type, expected string.");
        }

        if (empty($string)) {
            throw new \InvalidArgumentException("Cannot slugify an empty string.");
        }

        // Replace some language-specific characters which are not handled by
        // iconv transliteration satisfactorily.
        $string = strtr($string, CharacterMap::get());

        // Replace non-alphanumeric characters by "-"
        $string = preg_replace('/[^\\p{L}\\d]+/u', '-', $string);

        // Trim
        $string = trim($string, '-');

        // Transliterate
        $string = iconv('utf-8', 'ASCII//TRANSLIT', $string);

        // Lowercase
        $string = strtolower($string);

        // Remove unwanted characters
        $string = preg_replace('/[^-\w]+/', '', $string);

        return $string;
    }