madd/silex-fractal-service-provider

A Silex Service Provider for Fractal

dev-master 2013-12-20 15:48 UTC

This package is not auto-updated.

Last update: 2024-04-22 23:58:45 UTC


README

Build Status Coverage Status Latest Stable Version Total Downloads

Fractal Service Provider for Silex

Install

Via Composer

{
    "require": {
        "madd/silex-fractal-service-provider": "dev-master"
    }
}

Usage

use League\Fractal\Collection;

/**
 * You can set the scope identifier that Fractal uses to get its embeds here.
 * If not set here, it will default to 'embed'
 */
$app->register(new Madd\Silex\Provider\Fractal\FractalServiceProvider, array(
    'fractal.scope_identifier' => 'embed'
));

$resource = new Collection($model, new ModelTransformer);
$data     = $app['fractal']->createData($resource);

print_r($data->toArray());

TODO

Note: The build is only passing because I have a test that only tests if true is true.. I still have to implement tests.

  • Unit test to fuck

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.