2017 © Pedro Peláez
 

library larasponse

image

sorskod/larasponse

  • Sunday, February 21, 2016
  • by salebab
  • Repository
  • 4 Watchers
  • 77 Stars
  • 102,035 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 21 Forks
  • 10 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

NOTE: Laravel 5 is still in development but there is a working branch which support it - dev-L5. Feel free to check the code and contribute., (*1)

Larasponse

Beautiful and easy to use API responses. It uses League/Fractal as a default provider., (*2)

Installation

Add Larasponse to your composer.json file:, (*3)

"require": {
    "sorskod/larasponse": "~1.0"
}

and run composer update sorskod/larasponse, (*4)

Registering the Package

Register the service provider within the providers array found in app/config/app.php:, (*5)

'providers' => array(
    // ...
    'Sorskod\Larasponse\LarasponseServiceProvider'
)

Usage

Here is various examples in single controller:, (*6)


use Sorskod\Larasponse\Larasponse; class UserController extends BaseController { protected $response; public function __construct(Larasponse $response) { $this->response = $response; // The Fractal parseIncludes() is available to use here $this->response->parseIncludes(Input::get('includes')); } public function index() { return $this->response->paginatedCollection(User::paginate()); } public function show($id) { return $this->response->item(User::find($id), new UserTransformer()); } public function collection() { return $this->response->collection(User::all(), new UserTransformer(), 'users'); } }

Read more...

The Versions

21/02 2016

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Aleksandar Babic

06/07 2015

dev-L5

dev-L5

  Sources   Download

The Requires

 

The Development Requires

by Aleksandar Babic

09/10 2014

1.0.2

1.0.2.0

  Sources   Download

The Requires

 

by Aleksandar Babic

14/09 2014

1.0.1

1.0.1.0

  Sources   Download

The Requires

 

by Aleksandar Babic

14/09 2014

1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Aleksandar Babic