-
-
Notifications
You must be signed in to change notification settings - Fork 97
Transformation
Max edited this page Oct 21, 2018
·
5 revisions
One of the features of this boilerplate is to allow for configuring which case type you would like in your responses. Currently the options "camel-case" and "snake-case" are supported.
You can change this setting in your config/api.php file, the setting is under the name "formatsOptions.caseType".
This boilerplate also accepts a special header named "X-Accept-Case-Type", which will override any configuration (as specified above) and allow the request caller to specify the case type they would prefer. This is especially useful if you have multiple API consumers, and they have different preferences for case type.
PHP Guzzle Example:
$api->get('http://your-api.com/resource', [
'headers' => ['X-Accept-Case-Type' => 'snake-case'],
]);