Looking to hire Laravel developers? Try LaraJobs

laravel-convert-case-middleware maintained by arkn

Description
Convert request and response keys to and from camel and snake case.
Author
Last update
2026/06/22 19:37 (dev-master)
License
Links
Downloads
543

Comments
comments powered by Disqus

Laravel Convert Case Middleware

🛠️ Fork of tomlerendu/laravel-convert-case-middleware with Laravel 11 support.

Actions Status

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

Why?

Its convention to work with camel case in Javascript and snake case in PHP.

Requirements

Laravel 5.2+

Installation

  1. composer require arkn/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',
        \TomLerendu\LaravelConvertCaseMiddleware\ConvertRequestToSnakeCase::class,
        \TomLerendu\LaravelConvertCaseMiddleware\ConvertResponseToCamelCase::class,
    ],
];