Download the PHP package teners/laravel-key-case without Composer
On this page you can find all versions of the php package teners/laravel-key-case. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teners/laravel-key-case
More information about teners/laravel-key-case
Files in teners/laravel-key-case
Package laravel-key-case
Short Description Middleware for automatic case transformation of request and response data key in Laravel applications.
License MIT
Homepage https://github.com/Teners-net/laravel-key-case#readme
Informations about the package laravel-key-case
Laravel Key Case
A Laravel package that transforms request and response data keys.
Why?
It is a common convention to work with camel case in Javascript and most front-end technologies and snake case in PHP (Backend), this package makes that a breeze as you can work with your data columns just as you like in laravel and your responces or request data are automatically converted to any case.
Installation
Install Laravel Key Case, run the following command in your terminal:
Publish the package configuration file
You can then customize what case to use for each of the request and the response data.
Use the middlewares
This package includes two middlewares
TransformResponseMiddleware
: Transforms response data keys.TransformRequestMiddleware
: Transforms request data keys.
You can register their aliases (or use them dirrectly on the api route group if you are using them through the api) for easy reference elsewhere in your app:
In Laravel 11 open /bootstrap/app.php
and register them there:
In Laravel 9 and 10 you can add them in /app/Http/Kernel.php
:
Ignoring Routes
You can specify routes to be ignored for request and response transformation in the configuration file:
Route listed in the ignore
will not be transformed for bothe the resquest and response, while those in the ignoreRequest
will not be transformed for only the request, and those in ignoreResponse
will be ignored for the response transformation.
Contributions
Contributions are welcome via Pull Requests on Github.
- Please document any change you made as neccesary in the README.md.
- Pleas make only one pull request per feature/fix.
Issues
Please report any issue you encounter in using the package through the Github Issues tab.
Testing
To run tests, use:
Credits
Contributors
Contributors list will be added here
License
The MIT License (MIT). Please see License File for more information.