stephenlake / laravel-shovel
A minimal package for shovelling data from an API to clients, for Laravel.
Installs: 3 290
Dependents: 0
Suggesters: 0
Security: 0
Stars: 96
Watchers: 5
Forks: 4
Open Issues: 0
pkg:composer/stephenlake/laravel-shovel
Requires (Dev)
- laravel/framework: ~5.5.0|~5.6.0|~5.7.0
 - orchestra/testbench: ~3.4.0|~3.5.0|~3.6.0
 - phpunit/phpunit: ~7.0
 
README
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. DRY.
Getting Started
Install the package via composer.
composer require cloudcake/laravel-shovel
Transform Post::paginate(); into
{
  "meta": {
    "status": "success",
    "message": "OK",
    "code": 200,
    "pagination": {
      "records": 42312,
      "page": 1,
      "pages": 2821,
      "limit": 15
    }
  },
  "data": [{...},{...},{...}]
}
Using regular methods, response(Post::paginate()); or response(Resource::collection(Post::paginate()).
See documentation for more information.
License
This library is licensed under the MIT License - see the LICENSE.md file for details.