2017 © Pedro PelĂĄez
 

library fractalfy

Laravel wrapper for Fractal.

image

hesto/fractalfy

Laravel wrapper for Fractal.

  • Monday, February 13, 2017
  • by Hesto
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,596 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Fractalfy

Laravel Wrapper for Fractal, (*1)

Usage

Step 1: Install Through Composer

composer require hesto/fractalfy

Step 2: Register Service Provider

Add your new provider to the providers array of config/app.php:, (*2)

  'providers' => [
      // ...
      Hesto\Fractalfy\FractalfyServiceProvider::class,
      // ...
  ],

Fractal methods

Extend your controller with FractalfyController, (*3)

class DashboardController extends FractalfyController
{
    ...
}

Return collection, (*4)

$users = Users::all();
return $this->fractal
    ->collection($users, new UserTransformer)
    ->get();

Return resource with pagination, (*5)

$users = Users::all();
return $this->fractal
    ->paginate($users, new UserTransformer)
    ->get();

Fractalfy Helpers

Use Fractalfy Helpers (already included in FractalfyController), (*6)

Popular, (*7)

return $this->respondOK();
return $this->respondNotFound();
return $this->respondUnauthorized();
return $this->respondUnprocessable();
return $this->respondBadRequest();
return $this->respondWithSuccess(200); //any success code
return $this->respondWithError(400); //any success code

Other, (*8)

return $this->respondOK($message); //pass message to respond
return $this->setMessage($message)->respondOK();
return $this->setMessage($message)->setStatusCode($statuscode)->respondWithSuccess(); 
return $this->setMessage($message)->setStatusCode($statuscode)->respondWithError(); 

The Versions

13/02 2017

dev-master

9999999-dev

Laravel wrapper for Fractal.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Piotr Ɓosiak
by Andrzej Ć»mudziƄski

laravel api fractal

13/02 2017

v1.0.2

1.0.2.0

Laravel wrapper for Fractal.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Piotr Ɓosiak
by Andrzej Ć»mudziƄski

laravel api fractal

30/01 2017

v1.0.1

1.0.1.0

Laravel wrapper for Fractal.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Piotr Ɓosiak
by Andrzej Ć»mudziƄski

laravel api fractal

15/01 2017

v1.0.0

1.0.0.0

Laravel wrapper for Fractal.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Piotr Ɓosiak
by Andrzej Ć»mudziƄski

laravel api fractal