cyvelnet/laravel5-fractal
Laravel 5 Fractal offers a simple Laravel-friendly wrapper around League Fractal for transforming Eloquent models and collections into clean API responses, with reusable transformers, includes, serializers, and pagination support.
League\Fractal\Manager into the container, plus an Artisan make:transformer generator (and likely a config file/facade). The actual transformation logic lives in league/fractal. It fits Laravel's service-provider/container idiom cleanly, but its value is developer ergonomics, not architecture. It is trivially replaceable with ~50 lines of internal code, which materially lowers dependency risk. It only makes sense if the team has deliberately chosen Fractal's model (transformers, includes, sparse fieldsets, JsonApi/Array serializers) over Laravel's native API Resources.composer require cyvelnet/laravel5-fractal, rely on auto-discovery (Laravel 5.5+), optionally publish config, then generate transformers. No schema migrations, no infrastructure changes, no runtime service dependencies. A one-endpoint spike can validate fit in an afternoon.league/fractal maturing/stagnating and drifting from current PHP/Laravel versions. Because the package is thin, "fork and own it" is a cheap mitigation. The main functional risk is silent output-shape differences (serializers, includes, null handling) relative to native resources.league/fractal compatible?league/fractal constraints. For greenfield Laravel 9/10/11, native API Resources are the lower-risk default.Manager instantiation with the package binding, then verify byte-for-byte output parity via snapshot tests.JsonResource, map includes to whenLoaded/whenIncluded, replace serializers with resource wrapping; migrate endpoint by endpoint.spatie/laravel-fractal has a similar surface if Fractal itself is required.league/fractal version constraints, and watch for deprecated null-serializer behavior and return-type changes. Run the full test suite against the target version matrix in CI.league/fractal releases, security advisories, and PHP/Laravel EOL dates. Budget a small recurring review cadence; maintain an internal fork if upstream goes quiet. The thinness of the package means maintenance cost is mostly "watch upstream."Manager; version drift breaking transformers; the generator writing to unexpected namespaces/paths; abandonment blocking framework upgrades; output-shape regressions when Fractal changes defaults. Mitigations: golden-output tests, strict version pins, and an adapter layer so swapping to native resources is a one-file change.How can I help you explore Laravel packages today?