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

Laravel Fractal Laravel Package

gathercontent/laravel-fractal

A Laravel wrapper for the Fractal library that helps you transform Eloquent models, collections, and paginators into clean API responses with support for includes, serializers, and flexible resource transformations.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Thin Laravel service provider that binds league/fractal's Manager into the container and exposes it via a facade and helper functions. This is idiomatic Laravel (IoC + facade) and imposes no opinion on domain architecture.
  • Appropriate for teams that want Fractal's transformer/serializer model (includes, sparse fieldsets, JSON-API/array serializers, pagination adapters) rather than Laravel's native JsonResource.
  • Fits well in layered Laravel APIs where transformers are treated as a presentation layer decoupled from Eloquent models.

Integration feasibility

  • Composer-installable with Laravel package auto-discovery; minimal configuration surface. A publishable config file controls the default serializer.
  • Low integration cost: one endpoint can adopt it without a project-wide refactor. The real effort is authoring transformers and establishing conventions, not wiring the provider.
  • No database, queue, or infrastructure dependencies; the only transitive dependency is league/fractal.

Technical risk

  • The package is small (50 stars, score ~2.0), indicating limited community scrutiny and low maintenance signal. Single-maintainer/backer risk (GatherContent) is material.
  • league/fractal itself has slowed in release cadence; Laravel's native Eloquent API Resources cover much of the same ground, so long-term relevance is uncertain.
  • Composer constraint drift against newer Laravel/PHP versions is the most likely breakage; pinning league/fractal can conflict with other packages.
  • Fractal transformer include resolution can introduce hidden N+1 query patterns if not audited.

Key questions

  • What Laravel and PHP versions are declared in composer.json, and does that cover our target runtime?
  • Is there a maintained fork or can we vendor/patch it if upstream stalls?
  • Do we need Fractal-specific features (JSON-API serializer, cursor pagination adapters) that native Resources do not provide?
  • Who owns transformer conventions and code review within our team?
  • What is the exit cost to migrate to native API Resources if the package is abandoned?

Integration Approach

Stack fit

  • Native to a Laravel monolith or API-only Laravel service using Composer. Conflicts only if another dependency pins a different league/fractal major.
  • Fits cleanly alongside existing controllers, form requests, and policies; no runtime services to provision.

Migration path

  • Adopt incrementally: introduce the provider, then migrate endpoints one at a time behind transformers. Legacy responses remain untouched.
  • Provide a documented reversal path: transform logic can be ported to JsonResource classes, so treat transformers as a bounded presentation layer, not core domain code.
  • Avoid coupling Eloquent models to Fractal serializers; keep transformers in a dedicated namespace to simplify a future exit.

Compatibility

  • Validate the declared Laravel/PHP constraints against our current and next-upgrade targets before committing.
  • Lock league/fractal to a tested minor and monitor upstream; run composer why-not checks in the upgrade pipeline.
  • Confirm serializer choice (Array vs JSON-API) early, since it changes the public response contract.

Sequencing

  1. Spike one read-heavy endpoint; measure query count and payload parity.
  2. Establish transformer, serializer, and pagination conventions plus a style guide.
  3. Publish config and wire the provider in the base application.
  4. Roll out endpoint-by-endpoint with contract tests at each step.
  5. Add dependency-health monitoring (abandonment, constraint drift) to the backlog.

Operational Impact

Maintenance

  • Extremely small code footprint means minimal maintenance burden while upstream is healthy.
  • Primary ongoing cost is dependency stewardship: Fractal version pinning, Laravel upgrade compatibility, and periodic review of abandonment signals.
  • Budget a contingency to fork or vendor the provider; the surface area is small enough that a fork is low-effort.

Support

  • Community support is thin at 50 stars; expect self-support. Internal documentation and ownership are essential.
  • Rely on league/fractal documentation for transformer/serializer semantics, not the wrapper.

Scaling

  • Transformation is CPU-bound and in-process; acceptable for typical API volumes. Watch memory and latency on large collections or deeply nested includes.
  • Pagination for large result sets must go through Fractal's pagination adapters to avoid loading full collections.
  • Horizontal scaling is unaffected; the provider adds no shared state.

Failure modes

  • Composer constraint conflicts during Laravel/PHP upgrades.
  • Silent N+1 queries from include resolution causing latency regressions under load.
  • Serializer misconfiguration changing the response contract and breaking API consumers.
  • Upstream abandonment leaving incompatibility unpatched.

Ramp-up

  • Low for Laravel developers: the provider itself is trivial; the learning curve is Fractal's concepts (transformers, includes, serializers, pagination).
  • Plan a short internal workshop and a reference endpoint; expect roughly a day for a mid-level developer to become productive, plus review time for transformer conventions.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core