thephpleague/fractal

Output complex, flexible, AJAX/RESTful data structures.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 12 minutes ago
Added to GitGenius on September 19th, 2026
Created on November 26th, 2013
Open Issues & Pull Requests: 54 (+0)
GitHub issues: Enabled
Number of forks: 345
Total Stargazers: 3,544 (+0)
Total Subscribers: 84 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 89.1 days
Mean response time: 237.6 days
90th percentile: 974.3 days
Tracked items: 5

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 0
New in 7 days: 0
Closed in 7 days: 0
Avg open age: N/A days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Fractal is a PHP library that provides a presentation and transformation layer for complex data output in RESTful APIs and JSON responses.

The problem Fractal solves is the inconsistency and fragility that comes from directly serializing database objects to JSON. When APIs grab data from the database and pass it straight to json_encode(), schema changes break client applications and output becomes unpredictable. Fractal creates a protective shield between source data and API output by introducing transformers that systematically handle type-casting, relationship inclusion, and serialization. This approach lets you define how data should be presented independently of how it is stored, supporting standards like HAL and JSON-API while allowing custom serialization strategies.

Adopt Fractal if you are building a public-facing or mobile-consumed API where output consistency matters. The tool is particularly suited for APIs with complex nested data structures and relationships that need to be embedded or side-loaded. It handles pagination for both small and large datasets and eliminates the need to manually foreach through collections casting types. The README does not compare Fractal to alternative libraries, so no comparative guidance can be offered.

The project maintains active engagement with pull requests and issues, indicating responsive maintenance. Documentation is comprehensive and separately maintained, showing commitment to user onboarding. The codebase adheres to PHP standards PSR-1, PSR-2, and PSR-4, with explicit attention to compliance noted in the README. Testing infrastructure is in place as a core part of the development workflow. The project has established contribution guidelines and a code of conduct, signaling a structured approach to community participation.