v1.0.0 - Initial Release
Release v1.0.0 - Initial Release
Laravel Resource Reducer is finally out and ready to use.
Documentation: https://reducer.shipsaas.tech/
Installation
composer require shipsaas/laravel-resource-reducer
Usage
Backend
class UserResource extends JsonReducerResource
{
public function definitions(Request $request): array
{
return [
'id' => fn () => $this->id,
'email' => fn () => $this->email,
'created_at' => fn () => $this->created_at,
];
}
}
Consumer
http://api/users?_fields[]=id,_fields[]=email
// an array of users(id, email) will be returned (no other fields)
Cheers ❤️