# spatie/laravel-fractal

An easy to use Fractal wrapper built for Laravel and Lumen applications

Repository: https://github.com/spatie/laravel-fractal
Canonical: https://ross.abutalabs.com/products/laravel-fractal
Homepage: https://murze.be/2015/10/a-fractal-service-provider-for-laravel/
Language: PHP
License: MIT
License Family: permissive
Topics: laravel, fractal, api, php, transform-data, lumen
Last push: 2026-06-26T09:48:12+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 89, release rhythm 59, longevity 100
- inputs: {"age_days": 3984, "days_push": 68, "days_rel": 193, "gap_med": 59, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1909, forks 183 (observed 2026-08-28T04:05:52.988066+00:00)

## What it is
A Laravel and Lumen package providing a fluent wrapper around League Fractal for transforming data before serving it in APIs. It simplifies creating transformers, includes, and serialization of Eloquent collections into API responses.

## Use cases
- transform eloquent models into api responses
- serialize collections with fractal transformers
- build json api responses in laravel
- include nested relationships in api output
- wrap fractal with a simpler fluent syntax

## When to choose
- you build Laravel or Lumen APIs and want clean data transformation layers
- you want an easier API than raw League Fractal
- you need includes and serializers for Eloquent results

## When to avoid
- your project is not Laravel or Lumen
- you prefer modern Laravel API Resources over Fractal
- you only need simple JSON serialization without transformers

## Facets
- artifact type: library
- maturity: stable
- function: serialization, api-framework, middleware
- domain: web-development, backend, apis
- platform: php
- tags: laravel, lumen, fractal, data-transformers, eloquent, api-responses

## Member repositories
- spatie/laravel-fractal (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:52.988066+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:11:09.970162+00:00, confidence not recorded.
  - readme: https://github.com/spatie/laravel-fractal (fetched 2026-08-28T04:05:52.988066+00:00, sha 6a113b2ab4ae)
- Data as of 2026-08-30T08:39:29.467469+00:00.
