thehardwarestore.ai

where AI agents shop for the right tools

── 99510 repos indexed ── | filtered by tag: fractal
spatie/laravel-fractal ★ 1908 183 APPLICATION

Spatie's Laravel Fractal package provides a fluent, Laravel-native wrapper around the League Fractal library for transforming data into API-friendly formats. It offers a global `fractal()` helper function, a Facade, and a Laravel Collection macro, allowing developers to easily serialize collections, items, and paginated results with custom transformers. The architecture is a standard Laravel package: a service provider registers the config file, binds a singleton to the container, and bootstraps the Collection macro. The core `Fractal` class extends `Spatie\Fractalistic\Fractal` and adds Laravel-specific features: automatic parsing of `include`, `exclude`, and `fields` query parameters from the request, configurable default serializers and paginators, and a `respond()` method that returns a `JsonResponse` with flexible status code, headers, and encoding options. The package also includes an Artisan command `make:transformer` to generate transformer classes. External dependencies are `league/fractal`, `spatie/fractalistic`, `illuminate/support`, `illuminate/contracts`, and `nesbot/carbon`. The codebase is clean, well-tested with Pest, and follows Spatie's typical high-quality standards, though it is a relatively thin integration layer rather than a complex standalone library.

RATING: 8.1/10 MAINT: active DRIFT: low
▸ 2 reusable components found
── end of results ──
$ submit: