$value) { $snakeKey = camel_to_snake($key); $converted[$snakeKey] = $value; } return $converted; } } if (!function_exists('snake_to_camel')) { function snake_to_camel(string $string): string { $parts = explode('_', $string); $camel = array_map(function ($part, $index) { if ($index === 0) { return $part; } return ucfirst($part); }, $parts, array_keys($parts)); return implode('', $camel); } } if (!function_exists('snake_to_camel_array')) { function snake_to_camel_array(array $data): array { $converted = []; foreach ($data as $key => $value) { $camelKey = snake_to_camel($key); $converted[$camelKey] = $value; } return $converted; } }