Skip to content

v1.0.0 - Initial Release

Compare
Choose a tag to compare
@sethsandaru sethsandaru released this 07 Sep 13:43
· 5 commits to main since this 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 ❤️