2017 © Pedro Peláez
 

library laravel-api-response

A Laravel wrapper for thephpleague's Fractal package

image

lykegenes/laravel-api-response

A Laravel wrapper for thephpleague's Fractal package

  • Wednesday, November 4, 2015
  • by Lykegenes
  • Repository
  • 1 Watchers
  • 3 Stars
  • 169 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

laravel-api-response

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

A Laravel wrapper for thephpleague's Fractal package, (*2)

Install

Via Composer, (*3)

``` bash composer require lykegenes/laravel-api-response, (*4)


Then, add this to your Service Providers : ``` php Lykegenes\ApiResponse\ServiceProvider::class,

...and this to your Aliases : ``` php 'ApiResponse' => Lykegenes\ApiResponse\Facades\ApiResponse::class,, (*5)


Optionally, you can publish and edit the configuration file : ``` bash php artisan vendor:publish --provider="Lykegenes\ApiResponse\ServiceProvider" --tag=config

Usage

The easiest way to use this package is to call the make() function from the facade. It will try to guess your input. For the transformers, see the docs from the Fractal package here. ``` php // You can use a class directly to return a paginated collection return ApiResponse::make(User::class, UserTransformer::class);, (*6)

// You can also use an Eloquent Query return ApiResponse::make(User::where('age', '<', '40'), UserTransformer::class);, (*7)

// This will return a single object return ApiResponse::make(User::findOrFail($id), UserTransformer::class);, (*8)


## Testing ``` bash composer test

Credits

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

27/10 2015

dev-master

9999999-dev https://github.com/lykegenes/laravel-api-response

A Laravel wrapper for thephpleague's Fractal package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api fractal lykegenes laravel-api-response

27/10 2015

1.2.0

1.2.0.0 https://github.com/lykegenes/laravel-api-response

A Laravel wrapper for thephpleague's Fractal package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api fractal lykegenes laravel-api-response

14/09 2015

1.0.0

1.0.0.0 https://github.com/lykegenes/laravel-api-response

A Laravel wrapper for thephpleague's Fractal package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api fractal lykegenes laravel-api-response