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.
laravel-fractal, API Resources, or plain league/fractal are the realistic options.Consider it when all of the following hold:
services.yml loading are the norm.league/fractal and have hit the friction point where transformers need collaborators (repositories, tenant context, URL signing) and are currently doing service-locator hacks or new-ing dependencies inside transform().Look elsewhere when any of the following hold:
!tagged_iterator, and Autoconfigure attributes make the bundle's core value proposition redundant; you can register transformers as services and inject the Fractal Manager directly in an afternoon.spatie/laravel-fractal, Eloquent API Resources, or hand-rolled transformers with container resolution.symfony/serializer with serialization groups, or a DTO/hydration approach (e.g., cuyz/valinor) gives you OpenAPI generation, validation, and typed contracts that Fractal-plus-glue does not.Decision rule: treat the package as a pattern reference, not a dependency. The reusable insight — transformer-as-service with constructor injection — should be copied into your own thin integration, which you then own and can keep current.
To executives (one paragraph): This is a small, single-purpose glue library that connects a response-transformation library to Symfony's dependency injection container. It costs almost nothing to evaluate and nothing to replace — but it is archived, has had no release since 2020, and no known downstream users, so it is not something we should build a roadmap on. The strategic value is the pattern it demonstrates: keeping API response shaping in dedicated, injectable, unit-testable classes rather than scattering it through controllers. Recommendation: adopt the pattern internally, do not adopt the dependency for anything customer-facing.
To engineering leadership: The artifact is ~a compiler pass and a service definition. Its only durable contribution is normalizing "transformers are container services." We can reproduce that in our own codebase in roughly a day, retain full control, and stay compatible with current Symfony. Adopting the archived bundle instead buys us a fork obligation with no maintenance upside. Where we are on Symfony 2/3 and already standardized on league/fractal, a short-lived adoption (or vendoring) is defensible as a bridge; anywhere else, it is net-negative.
To the engineering team: Use this repository as a worked example of wiring third-party managers into a container and injecting collaborators into transformers — read it, then write our own integration with tagged services and constructor injection. Standardize on one transformation approach per API surface, keep transformers dependency-injected and independently testable, and make the response envelope (pagination, includes, errors) an explicit, versioned contract rather than an accident of ORM serialization.
How can I help you explore Laravel packages today?