Laravel Shovel is a minimalist package providing Laravel response macros to assist in rapid API development by transforming models, resources, collections, paginated objects and errors into a concise API response format.

laravel shovel

laravel shovel

Installation

Install the package via composer.

composer require stephenlake/laravel-shovel

Usage

Transform Post::paginate(); into

{
  "meta": {
    "status": "success",
    "message": "OK",
    "code": 200,
    "pagination": {
      "records": 42312,
      "page": 1,
      "pages": 2821,
      "limit": 15
    }
  },
  "data": [{...},{...},{...}]
}