2017 © Pedro Peláez
 

library lumen-fractal

Fractal module for the Lumen PHP framework.

image

nordsoftware/lumen-fractal

Fractal module for the Lumen PHP framework.

  • Friday, March 16, 2018
  • by crisu83
  • Repository
  • 28 Watchers
  • 27 Stars
  • 4,258 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 2 Forks
  • 2 Open issues
  • 8 Versions
  • 9 % Grown

The README.md

Lumen Fractal

Build Status Code Climate Coverage Status Latest Stable Version Total Downloads License, (*1)

Fractal module for the Lumen PHP framework., (*2)

Requirements

  • PHP 5.6 or newer
  • Lumen 5.1 or newer
  • Composer

Setup

Installation

Run the following command to install the package through Composer:, (*3)

composer require nordsoftware/lumen-fractal

Configuration

Copy the configuration template in config/fractal.php to your application's config directory and modify according to your needs. For more information see the Configuration Files section in the Lumen documentation., (*4)

Available configuration options:, (*5)

  • default_serializer - Default serializer to use for serialization, defaults to null

Bootstrap

Add the following lines to bootstrap/app.php:, (*6)

$app->register('Nord\Lumen\Fractal\FractalServiceProvider');

Optionally you can also use Nord\Lumen\Fractal\FractalMiddleware to parse includes automatically from the request., (*7)

$app->middleware([
    .....
    'Nord\Lumen\Fractal\Middleware\FractalMiddleware',
]);

Usage

You can now use Nord\Lumen\Fractal\FractalService to access Fractal anywhere in your application., (*8)

Here is a few examples on how you can serialize data if you are using Eloquent:, (*9)

public function getBook(FractalService $fractal, $id) {
  // load the book model ...

  return response()->json($fractal->item($book, new BookTransformer)->toArray());
}
public function listBooks(FractalService $fractal) {
  // load the book collection ...

  return response()->json($fractal->collection($books, new BookTransformer)->toArray());
}

Contributing

Please read the guidelines., (*10)

Running tests

Clone the project and install its dependencies by running:, (*11)

composer install

Run the following command to run the test suite:, (*12)

vendor/bin/codecept run unit

License

MIT, see LICENSE., (*13)

The Versions

16/03 2018

dev-develop

dev-develop

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

28/11 2017

2.0.x-dev

2.0.9999999.9999999-dev

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall
by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

14/04 2016

dev-master

9999999-dev

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

14/04 2016

1.3.0

1.3.0.0

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

14/04 2016

1.2.1

1.2.1.0

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

08/04 2016

1.2.0

1.2.0.0

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund
by Jonas Engström

laravel api json lumen serialization fractal

30/03 2016

1.0.1

1.0.1.0

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api json lumen serialization fractal

05/03 2016

1.0.0

1.0.0.0

Fractal module for the Lumen PHP framework.

  Sources   Download

MIT

The Requires

 

The Development Requires