framework/helpers/BaseInflector.php
public static function camel2id($name, $separator = '-', $strict = false)
    {
        $regex = $strict ? '/\p{Lu}/u' : '/(?<!\p{Lu})\p{Lu}/u';
        if ($separator === '_') {
            return mb_strtolower(trim(preg_replace($regex, '_\0', $name), '_'), self::encoding());
        }

        return mb_strtolower(trim(str_replace('_', $separator, preg_replace($regex, $separator . '\0', $name)), $separator), self::encoding());
    }
public static function camel2id($name, $separator = '-', $strict = false)
    {
        $regex = $strict ? '/\p{Lu}/u' : '/(?<!\p{Lu})\p{Lu}/u';
        if ($separator === '_') {
            return mb_strtolower(trim(preg_replace($regex, '_\0', $name), '_'), self::encoding());
        }

        return mb_strtolower(trim(str_replace('_', $separator, preg_replace($regex, $separator . '\0', $name)), $separator), self::encoding());
    }
Converts a CamelCase name into an ID in lowercase.
Words in the ID may be concatenated using the specified character (defaults to '-').
For example, 'PostTag' will be converted to 'post-tag'.
@param string $name the string to be converted
@param string $separator the character used to concatenate the words in the ID
@param bool|string $strict whether to insert a separator between two consecutive uppercase chars, defaults to false
@return string the resulting ID