madd / silex-fractal-service-provider

此包已被放弃,不再维护。没有建议替代包。

Fractal的Silex服务提供程序

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

This package is not auto-updated.

Last update: 2024-09-24 01:53:31 UTC


README

Build Status Coverage Status Latest Stable Version Total Downloads

Fractal为Silex提供的服务程序

安装

通过Composer

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

使用方法

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());

待办事项

注意:构建通过是因为我有一个只测试true是否为真的测试,我还需要实现测试。

  • 单元测试去死

测试

$ phpunit

贡献

请参阅CONTRIBUTING以获取详细信息。

鸣谢

许可

MIT许可(MIT)。请参阅许可文件获取更多信息。