embergrep / fractal-ember
A set of serializers for building Ember ready APIs using Fractal
0.1.0
2015-09-24 14:49 UTC
Requires
- php: >=5.3.0
- league/fractal: ^0.12.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2024-11-09 16:01:15 UTC
README
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.
Install
Via Composer
$ composer require embergrep/fractal-ember
Usage
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
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.