src/Utils.php
public static function camelCaseToUnderscore($string)
    {
        return Preg::replaceCallback(
            '/(^|[a-z0-9])([A-Z])/',
            static function (array $matches) {
                return strtolower('' !== $matches[1] ? $matches[1].'_'.$matches[2] : $matches[2]);
            },
            $string
        );
    }
public static function camelCaseToUnderscore($string)
    {
        return Preg::replaceCallback(
            '/(^|[a-z0-9])([A-Z])/',
            static function (array $matches) {
                return strtolower('' !== $matches[1] ? $matches[1].'_'.$matches[2] : $matches[2]);
            },
            $string
        );
    }
Converts a camel cased string to an snake cased string.

@param string $string

@return string