League Skeleton
, (*1)
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what
PSRs you support to avoid any confusion with users and contributors., (*2)
Install
Via Composer, (*3)
``` bash
$ composer require embergrep/fractal-ember, (*4)
## Usage
``` php
use Acme\Model\Book;
use Acme\Transformer\BookTransformer;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use Embergrep\Serializers\EmberSerializer;
$manager = new Manager();
$manager->setSerializer(new EmberSerializer());
// Some sort of ORM call
$book = Book::find(1);
// Make a resource out of the data and
$resource = new Item($book, new BookTransformer(), 'book');
// Run all transformers
$manager->createData($resource)->toArray();
// Outputs:
// [
// 'book' => [
// 'id' => 'Foo',
// 'title' => 'Foo',
// 'year' => 1991,
// ],
// 'authors' => [
// [
// 'id' => 'Baz',
// 'name' => 'Walter',
// ],
// ];
Testing
bash
$ phpunit, (*5)
Contributing
Please see CONTRIBUTING for details., (*6)
Credits
License
The MIT License (MIT). Please see License File for more information., (*7)