grohiro / laravel-camelcase-json
Convert response JSON key to camelCase
Installs: 70 428
Dependents: 0
Suggesters: 0
Security: 0
Stars: 27
Watchers: 4
Forks: 4
Open Issues: 5
This package is auto-updated.
Last update: 2024-11-20 19:26:42 UTC
README
Convert response JSON key to camelCase.
Usage
In controller class
return response()->json($model); // => ['userName' => 'foo', 'userKey' => 'bar', ...]
Requirements
- Laravel 5+
Install
$ composer require 'grohiro/laravel-camelcase-json' '~1.0' # Laravel 5.7+ $ composer require 'grohiro/laravel-camelcase-json' '~2.0'
Add the service provider.
config/app.php
'provider' => [ // default providers // ... Grohiro\LaravelCamelCaseJson\CamelCaseJsonResponseServiceProvider::class, ],