Closed djmattyg007 closed 7 years ago
Alternatively you could just pull out the relevant code from the symfony/serializer package and call it yourself manually, as it's only really a couple of lines of code:
public function snakeCaseToCamelCase($unnormalizedName)
{
$camelCasedName = preg_replace_callback('/(^|_)+(.)/', function ($match) {
return strtoupper($match[2]);
}, $unnormalizedName);
return lcfirst($camelCasedName);
}
Shoot a PR
Thx @denizdogan ! 👍
Given the only thing symonfy/serializer appears to be used for is to convert snake_case names to camelCase, it seems a bit unnecessary to require the entire serializer component for this one task. Surely a smaller, dedicated library would be more suited to the task? There are plenty of examples here: https://packagist.org/search/?q=camel