| Package Data | |
|---|---|
| Maintainer Username: | jlozanomaltos |
| Maintainer Contact: | jesusemanuel.254@gmail.com (Jesus Lozano) |
| Package Create Date: | 2016-01-23 |
| Package Last Update: | 2017-01-12 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-03 15:21:13 |
| Package Statistics | |
|---|---|
| Total Downloads: | 51 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 9 |
| Total Watchers: | 4 |
| Total Forks: | 2 |
| Total Open Issues: | 0 |
An array size reducer (for JSON output purposes) using Models, Collections, Arrays for Laravel/Lumen
It's basically an implementation of following: Smaller Serialized Data
{
"data": [
{
"id": 1,
"name": "Jesús Emanuel",
"lastname": "Lozano Maltos"
},
{
"id": 2,
"name": "Gilberto",
"lastname": "Reyes Barrera"
}
]
}
{
"data": {
{
"id":[1, 2],
"name": ["Jesús Emanuel", "Gilberto"],
"lastname": ["Lozano Maltos", "Reyes Barrera"]
}
}
}
Require package using composer
composer require jlozanomaltos/json-reducer
Then just require the class (where you need it)
use JLozanoMaltos\JsonReducer\JsonReducer;
public function index()
{
$users = User::all();
return response()->json(JsonReducer::reduce($users));
}