Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Fractal Bundle

Fractal Bundle Laravel Package

samj/fractal-bundle

Symfony bundle integrating League\Fractal for transforming API data with transformers, serializers, and includes. Fractal's manager, serializers, and transformers are wired through Symfony's DI container, so you can produce consistent, well-structured JSON responses for your REST API.

View on GitHub
Deep Wiki
Context7

A Symfony Bundle for Fractal by League. Implements dependency injection into your transformers

Frequently asked questions about Fractal Bundle
Is samj/fractal-bundle a Laravel package or a Symfony bundle?
It is a Symfony2 bundle, not a Laravel package. It exists to wire Symfony's service container into League\Fractal transformers so transformer classes can receive constructor dependencies. There is no Laravel service provider, no facade, and no config publishing, so none of the usual Laravel integration points apply. If you are evaluating it for a Laravel application, it is out of scope on day one.
Does samj/fractal-bundle work with Laravel?
No. The package targets Symfony 2.x service definition conventions and provides a bundle class registered in AppKernel, which Laravel has no concept of. Modern Laravel containers autowire transformer constructors natively, so the bundle's only real value proposition disappears anyway. In Laravel, bind League\Fractal\Manager as a singleton in a service provider and register transformers as ordinary autowired classes.
How do I install samj/fractal-bundle?
Installation is via Composer with composer require samj/fractal-bundle, followed by registering the bundle in your Symfony AppKernel and defining your transformers as services. There is no artisan command, no published configuration file, and no Laravel package discovery. Because the repository is archived and last released on 2020-06-19, expect dependency resolution problems on any modern PHP runtime before you get as far as configuration.
Is samj/fractal-bundle still maintained?
No. The repository is archived, the last release was 2020-06-19, and it has roughly 27 stars with zero dependents. Zero dependents is the strongest signal here: no downstream project validates that it installs and runs against anything current. Archived means no security patches, no PHP 8.x compatibility work, and no upstream fixes, so treat it as a closed book rather than a watch item.
Which Symfony and PHP versions does samj/fractal-bundle support?
It targets Symfony 2.x service definition conventions, a framework branch that reached end of life in 2018, and it almost certainly constrains league/fractal to a 0.x line. Installing it alongside PHP 8.x and a supported Symfony or Laravel release will likely fail Composer resolution outright. If it does resolve, it will be by pinning transitive dependencies to versions you do not want to defend in a security review.
How does samj/fractal-bundle inject dependencies into Fractal transformers?
The bundle registers your transformer classes as Symfony services so their constructor arguments are resolved by the DI container, and you then hand those transformer instances to Fractal resources instead of instantiating them inline. That keeps presentation logic out of controllers and makes transformers reusable and testable. It was genuinely useful in Symfony 2 where autowiring was immature, but on Laravel or modern Symfony the container already does this, so you can replicate the behaviour with a short service definition block.
How do I configure serializers in samj/fractal-bundle?
The bundle wires Fractal's Manager and its serializers into the container, so you select a serializer such as ArraySerializer, DataArraySerializer, or JsonApiSerializer through bundle configuration or a service definition. The Manager then applies that serializer consistently across every transformed item and collection, which is what gives you uniform API output. Because the package is archived, verify configuration keys against the README for the specific pinned 0.x Fractal version rather than assuming current Fractal documentation applies.
What should I use instead of samj/fractal-bundle in a Laravel application?
Start with framework-native options: Laravel API Resources handle transformation, collections, and conditional relationships without any extra dependency. If you specifically want Fractal's includes, embeds, and pagination adapters, bind League\Fractal\Manager as a singleton in a service provider and register transformers as autowired classes; community packages such as spatie/laravel-fractal already do exactly that. Either path removes a fragile, archived dependency rather than adding one.
How do I test Fractal transformers?
Transformers are plain classes, so instantiate them directly in unit tests and assert on the array returned by transform(). For integration coverage, resolve the Manager from the container, call createData() on an item or collection resource, and assert against the serialized array to catch serializer configuration drift. If you keep the bundle, wrap it behind your own service so tests do not depend on archived container wiring you cannot patch.
Is samj/fractal-bundle safe to use in production?
Technical risk is high and abandonment is realised rather than prospective, since the repository is archived and receives no security patches or PHP 8.x fixes. Adopting it would also pin Fractal and possibly PSR container versions, rippling into unrelated upgrade work. The only defensible scenario is an existing Symfony 2.x application that already depends on it and cannot be upgraded this quarter, and even then it should be a frozen, quarantined dependency with migration work planned.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource