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 Laravel Package

dmytrof/fractal-bundle

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Standardization: Adopting this bundle enables consistent API response formatting (JSON:API, HAL, GraphQL-like) across Symfony applications, reducing frontend-backend misalignment.
  • Roadmap for Microservices: Facilitates decoupled data transformation in a microservices architecture by abstracting serialization logic into reusable bundles.
  • Build vs. Buy: Avoids reinventing serialization wheels; leverages battle-tested League/Fractal (used by Laravel, Symfony, etc.) with minimal overhead.
  • Use Cases:
    • Legacy Modernization: Gradually introduce structured API responses in monolithic Symfony apps.
    • Multi-tenant APIs: Dynamically transform data per tenant/client requirements (e.g., masking PII).
    • Third-party Integrations: Standardize payloads for external services (e.g., payment gateways, analytics).

When to Consider This Package

  • Adopt if:

    • Your Symfony app (3/4/5) needs consistent API responses (e.g., JSON:API, HAL) without heavy custom code.
    • You’re already using League/Fractal in other PHP projects (familiarity reduces ramp-up).
    • Your team prioritizes developer velocity over fine-grained control (bundle handles boilerplate).
    • You require transformers for nested/complex data (e.g., relationships, pagination metadata).
  • Look elsewhere if:


How to Pitch It (Stakeholders)

For Executives: "This bundle lets us standardize how our Symfony APIs return data—like a ‘design system’ for JSON responses. By adopting League/Fractal (used by Laravel and others), we avoid reinventing serialization logic, speed up development, and ensure consistency across microservices. It’s a low-risk way to modernize APIs without overhauling existing code."

For Engineers: *"This wraps Fractal for Symfony, giving us:

  • Transformers: Cleanly shape complex data (e.g., hide internal IDs, nest relationships).
  • Format Flexibility: Output JSON:API, HAL, or custom formats with minimal config.
  • Symfony Integration: Works with Doctrine, Symfony’s DI, and controllers seamlessly. Tradeoff: Lightweight but unmaintained (last release 2021). If we need long-term support, we could fork it or switch to Symfony’s built-in Serializer. For now, it’s a drop-in solution for structured APIs."*

For Developers: *"No more writing ad-hoc JSON serialization in controllers. Define a transformer for your Article model once, and reuse it everywhere. Example:

// Transformer for Article
public function transform(Article $article) {
    return [
        'id' => $article->id,
        'title' => $article->title,
        'author' => $this->formatAuthor($article->author),
    ];
}

The bundle handles the rest—including nested data and metadata like pagination. Pro tip: Pair with NelmioApiDocBundle for auto-generated API docs."*

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.
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table