public static function camelize($str, $ucfirst = false)
    {
        $replace = str_replace(
            ' ',
            '',
            ucwords(str_replace(['_', '-'], ' ', strtolower($str)))
        );

        if (!$ucfirst) {
            return lcfirst($replace);
        }

        return $replace;
    }
public static function camelize($str, $ucfirst = false)
    {
        $replace = str_replace(
            ' ',
            '',
            ucwords(str_replace(['_', '-'], ' ', strtolower($str)))
        );

        if (!$ucfirst) {
            return lcfirst($replace);
        }

        return $replace;
    }
Returns given string as a camelCased word.

@param string $str
@param bool $ucfirst wheter to uppercase the first character
@return string