# thephpleague/fractal

Output complex, flexible, AJAX/RESTful data structures.

Repository: https://github.com/thephpleague/fractal
Canonical: https://ross.abutalabs.com/products/fractal
Language: PHP
License: MIT
License Family: permissive
Last push: 2025-12-16T16:24:18+00:00

## Health v2 (maintenance only)
Score: 56/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 57, release rhythm 29, longevity 100
- inputs: {"age_days": 4663, "days_push": 260, "days_rel": 260, "gap_med": 304, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3544, forks 345 (observed 2026-08-28T04:08:09.348636+00:00)

## What it is
A PHP library providing a presentation and transformation layer for complex data output in RESTful APIs, acting as a view layer for JSON. It separates source data from API output via transformers and serializers, supporting standards like JSON-API and HAL.

## Use cases
- transform database models into consistent JSON API responses
- serialize API output following JSON-API or HAL standards
- embed nested relationships in REST API responses
- paginate API data results
- shield API consumers from internal schema changes
- type-cast API response data systematically

## When to choose
- building a public REST API in PHP with complex data structures
- you need consistent, versioned API output instead of raw json_encode
- you want standards-compliant JSON-API or HAL serialization
- you need relationship embedding and pagination in API responses

## When to avoid
- building trivial internal APIs where json_encode suffices
- using a framework whose serializer already covers your needs
- working outside PHP

## Facets
- artifact type: library
- maturity: maintenance
- function: serialization, api-framework, middleware
- domain: apis, web-development, backend
- platform: php
- tags: rest-api, json-api, hal, data-transformation, transformers, pagination, php-league

## Member repositories
- thephpleague/fractal (main) score 56

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:09.348636+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-29T18:34:26.763992+00:00, confidence not recorded.
  - readme: https://github.com/thephpleague/fractal (fetched 2026-08-28T04:08:09.348636+00:00, sha 67f9eebbeeda)
- Data as of 2026-08-30T08:39:29.467469+00:00.
