Presentation and transformation layer for JSON API output in PHP
open sourceMITfree
Fractal is a PHP library from The League of Extraordinary Packages that sits between your data and your API's output, a view layer for JSON and similar formats. Transformers shield users from schema changes and cast types systematically; it includes (embeds or side-loads) related resources, paginates results, and serialises to HAL, JSON:API or a format of your own.
Problems it solves
- keep my PHP API's JSON output stable when the database changes
- embed related resources in a REST API response in PHP
- format API responses as JSON:API in PHP
Features
- transformers between models and API output
- includes for nested and side-loaded relationships
- HAL, JSON:API and custom serializers
- pagination support
