Download the PHP package paymaxi/fractal-bundle without Composer
On this page you can find all versions of the php package paymaxi/fractal-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paymaxi/fractal-bundle
More information about paymaxi/fractal-bundle
Files in paymaxi/fractal-bundle
Package fractal-bundle
Short Description A Symfony2 Bundle for Fractal by League. Implements dependency injection into your transformers
License MIT
Informations about the package fractal-bundle
League Fractal Symfony Bundle
This bundle provides integration of league/fractal for Symfony. In addition it allows you to use transformers as a services.
Getting Started
First of all you need to add dependency to composer.json:
Then register bundle in app/AppKernel.php
:
Now we can write and use fractal transformers:
Using Transformers as Services
There are several cases when you need to pass some dependencies into transformer. The common one is role/scope based results in transformers. For example you need to show email
field only for administrators or owner of user profile:
Then you could just register this class as service, and pass service ID as transformer. This bundle then will try to get it from container:
This works in includes as well:
You could see example of how to use transformers in sample application which is used in test suites.
License
The MIT License (MIT). Please see License File for more information.
All versions of fractal-bundle with dependencies
league/fractal Version ^0.16
paymaxi/compiler Version ^0.1
symfony/framework-bundle Version ^2.7|^3.0|^4.0