2017 © Pedro Peláez
 

library fravel

A Fractal wrapper for Laravel

image

plata/fravel

A Fractal wrapper for Laravel

  • Friday, September 15, 2017
  • by silverxjohn
  • Repository
  • 1 Watchers
  • 0 Stars
  • 491 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 5 % Grown

The README.md

Fravel

License, (*1)

A Fractal wrapper for Laravel, (*2)

Fractal is designed in such a way that it could be used by any frameworks or no framework at all. But wouldn't it be cool if we can use it like it's build right on top of Laravel?, (*3)

Installation

Composer

composer require plata/fravel

Then in your config/app.php's provider array:, (*4)

'providers' => [
  // ...
  'Plata\Fravel\FravelServiceProvider::class',
  // ...
]

and within the same file,, (*5)

'aliases' => [
  // ...
  ''Fractal' => \Plata\Fravel\Facade\Fractal::class',
  // ...
]

Usage

For a collection of resource,, (*6)

$resource = Fractal::collection(User::all(), $transformer);

return Response::fractal($resource);

For a single resource,, (*7)

$resource = Fractal::item(User::find(1), $transformer);

return Response::fractal($resource);

Generators

Everyone knows that developers doesn't like repetitive tasks. That's why generators are really helpful for creating a base template for you!, (*8)

Transformers

Existing Model and Migration, (*9)

php artisan make:transformer UserTransformer

For non existing model/migration, just append -t flag, (*10)

php artisan make:model User -m -t

Configurations

Fravel ships with a configuration file where you can change any Fractal specific behaviour. Just run:, (*11)

php artisan vendor:publish

Support

Need more control? Check this thorough documentation of Fravel., (*12)

The Versions

15/09 2017

dev-master

9999999-dev

A Fractal wrapper for Laravel

  Sources   Download

MIT

The Requires

 

by John Aldrin Plata

laravel api json standard fractal transformer

15/09 2017

v1.1.2

1.1.2.0

A Fractal wrapper for Laravel

  Sources   Download

MIT

The Requires

 

by John Aldrin Plata

laravel api json standard fractal transformer

08/09 2017

v1.1.1

1.1.1.0

A Fractal wrapper for Laravel

  Sources   Download

MIT

The Requires

 

by John Aldrin Plata

api fractal transformer

08/09 2017

v1.1.0

1.1.0.0

A Fractal wrapper for Laravel

  Sources   Download

MIT

The Requires

 

by John Aldrin Plata

api fractal transformer

25/06 2017

v1.1

1.1.0.0

A Fractal wrapper for Laravel

  Sources   Download

MIT

by John Aldrin Plata

25/06 2017

v1.0

1.0.0.0

A Fractal wrapper for Laravel

  Sources   Download

MIT

by John Aldrin Plata