programic/laravel-convert-case-middleware

Convert request and response keys to and from camel and snake case.

v1.1.0 2024-10-09 09:26 UTC

This package is auto-updated.

Last update: 2024-12-09 09:51:07 UTC


README

Latest Version on Packagist Tests Total Downloads

Convert requests from camel case to snake case. Convert responses from snake case to camel case.

#Installation

  1. composer require programic/laravel-convert-case-middleware
  2. Add the middleware to the appropriate group in App\Http\Kernel.php. For example
protected $middlewareGroups = [
    'api' => [
        'throttle:60,1',
        'bindings',
        \Programic\LaravelConvertCaseMiddleware\ConvertRequestToSnakeCase::class,
        \Programic\LaravelConvertCaseMiddleware\ConvertResponseToCamelCase::class,
    ],
];