grohiro / laravel-camelcase-json by grohiro

Convert response JSON key to camelCase
75,206
27
3
Package Data
Maintainer Username: grohiro
Package Create Date: 2017-04-20
Package Last Update: 2021-01-15
Language: PHP
License: MIT
Last Refreshed: 2025-04-10 15:16:59
Package Statistics
Total Downloads: 75,206
Monthly Downloads: 1,192
Daily Downloads: 77
Total Stars: 27
Total Watchers: 3
Total Forks: 4
Total Open Issues: 5

laravel-camelcase-json

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'

Add the service provider.

config/app.php

'provider' => [
	// default providers
	// ...
	
	Grohiro\LaravelCamelCaseJson\CamelCaseJsonResponseServiceProvider::class,
],