An open API service indexing awesome lists of open source software.

https://github.com/grohiro/laravel-camelcase-json

Convert response JSON key to camelCase
https://github.com/grohiro/laravel-camelcase-json

laravel-5-package laravel5

Last synced: 5 months ago
JSON representation

Convert response JSON key to camelCase

Awesome Lists containing this project

README

        

# laravel-camelcase-json

Convert response JSON key to camelCase.

## Usage

**In controller class**

```php
return response()->json($model);
// => ['userName' => 'foo', 'userKey' => 'bar', ...]
```

## Requirements

- Laravel 5+

## Install

```bash
$ 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**

```php
'provider' => [
// default providers
// ...

Grohiro\LaravelCamelCaseJson\CamelCaseJsonResponseServiceProvider::class,
],
```