PHPackages                             softcomtecnologia/fractal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. softcomtecnologia/fractal

ActiveLibrary[HTTP &amp; Networking](/categories/http)

softcomtecnologia/fractal
=========================

Handle the output of complex data structures ready for API output.

v8.1.0(6mo ago)05.0k↓33.3%MITPHPPHP &gt;=8.1

Since Nov 27Pushed 2mo agoCompare

[ Source](https://github.com/softcomtecnologia/fractal)[ Packagist](https://packagist.org/packages/softcomtecnologia/fractal)[ Docs](http://fractal.thephpleague.com/)[ RSS](/packages/softcomtecnologia-fractal/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (48)Used By (0)

Fractal
=======

[](#fractal)

[![Latest Version](https://camo.githubusercontent.com/49cc71f002ebbe18e2a5b5c812053bd03f9ac7c106995a249e873066e29e759a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7468657068706c65616775652f6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/thephpleague/fractal/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/34be2c8bd3b6620a5faa6c79303bba19de5840479e37ae8356947cca2cab35e0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468657068706c65616775652f6672616374616c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thephpleague/fractal)[![Coverage Status](https://camo.githubusercontent.com/3a194b83388485f7f4081de534c1d2b461dc3c3d639d2bd54bcb2027b8800225/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7468657068706c65616775652f6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/fractal/code-structure)[![Quality Score](https://camo.githubusercontent.com/61210fcd2cde96b241c359157d602312c306827196c53a2f688176289b47b5f4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468657068706c65616775652f6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/fractal)[![Total Downloads](https://camo.githubusercontent.com/71d0dd491e5330f126fcc744938a6a989da6726bb3cc5a0ab591e0e167ccabcb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616775652f6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/fractal)

Fractal provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with JSON. Think of this as a view layer for your JSON/YAML/etc.

When building an API it is common for people to just grab stuff from the database and pass it to `json_encode()`. This might be passable for "trivial" APIs but if they are in use by the public, or used by mobile applications then this will quickly lead to inconsistent output.

Goals
-----

[](#goals)

- Create a protective shield between source data and output, so schema changes do not affect users
- Systematic type-casting of data, to avoid `foreach()`ing through and `(bool)`ing everything
- Include (a.k.a embedding, nesting or side-loading) relationships for complex data structures
- Work with standards like HAL and JSON-API but also allow custom serialization
- Support the pagination of data results, for small and large data sets alike
- Generally ease the subtle complexities of outputting data in a non-trivial API

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
$ composer require league/fractal
```

Requirements
------------

[](#requirements)

The following versions of PHP are supported by this version.

- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- HHVM

Documentation
-------------

[](#documentation)

Fractal has [full documentation](http://fractal.thephpleague.com), powered by [Jekyll](http://jekyllrb.com/).

Contribute to this documentation in the [gh-pages branch](https://github.com/thephpleague/fractal/tree/gh-pages/).

Todo
----

[](#todo)

- add HAL serializers

Testing
-------

[](#testing)

```
$ phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/thephpleague/fractal/blob/master/CONTRIBUTING.md) and [CONDUCT](https://github.com/thephpleague/fractal/blob/master/CONDUCT.md) for details.

Maintainers
-----------

[](#maintainers)

- [Korvin Szanto](https://github.com/korvinszanto)
- [Matt Trask](https://github.com/matthewtrask)

Credits
-------

[](#credits)

- [Graham Daniels](https://github.com/greydnls)
- [Andrew Willis](https://github.com/willishq)
- [Phil Sturgeon](https://github.com/philsturgeon)
- [All Contributors](https://github.com/thephpleague/fractal/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/thephpleague/fractal/blob/master/LICENSE) for more information.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance76

Regular maintenance activity

Popularity22

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor5

5 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~111 days

Recently: every ~526 days

Total

40

Last Release

194d ago

Major Versions

0.18.0 → 1.0.x-dev2019-07-01

0.19.2 → v1.0.02020-09-10

v1.0.2 → v8.1.02025-10-30

PHP version history (5 changes)0.8.0PHP &gt;=5.3

0.12.0PHP &gt;=5.4

1.0.x-devPHP &gt;=7.2

v1.0.0PHP &gt;=7.1

v8.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/23b53d117e80a86fbcdf5c2755f36dd2c8275c41125d4c11c969cae95605fddb?d=identicon)[softcomtecnologia](/maintainers/softcomtecnologia)

---

Top Contributors

[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (49 commits)")[![willishq](https://avatars.githubusercontent.com/u/1564903?v=4)](https://github.com/willishq "willishq (34 commits)")[![greydnls](https://avatars.githubusercontent.com/u/1276798?v=4)](https://github.com/greydnls "greydnls (27 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (20 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (15 commits)")[![livkiss](https://avatars.githubusercontent.com/u/256075?v=4)](https://github.com/livkiss "livkiss (14 commits)")[![duythien](https://avatars.githubusercontent.com/u/1762691?v=4)](https://github.com/duythien "duythien (11 commits)")[![ipalaus](https://avatars.githubusercontent.com/u/248183?v=4)](https://github.com/ipalaus "ipalaus (8 commits)")[![KorvinSzanto](https://avatars.githubusercontent.com/u/1007419?v=4)](https://github.com/KorvinSzanto "KorvinSzanto (8 commits)")[![matthewtrask](https://avatars.githubusercontent.com/u/4731244?v=4)](https://github.com/matthewtrask "matthewtrask (8 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (6 commits)")[![marcaddeo](https://avatars.githubusercontent.com/u/199649?v=4)](https://github.com/marcaddeo "marcaddeo (6 commits)")[![vanbrabantf](https://avatars.githubusercontent.com/u/12281411?v=4)](https://github.com/vanbrabantf "vanbrabantf (6 commits)")[![niden](https://avatars.githubusercontent.com/u/1073784?v=4)](https://github.com/niden "niden (5 commits)")[![webda2l](https://avatars.githubusercontent.com/u/517753?v=4)](https://github.com/webda2l "webda2l (5 commits)")[![ceeram](https://avatars.githubusercontent.com/u/111448?v=4)](https://github.com/ceeram "ceeram (4 commits)")[![Elenthar](https://avatars.githubusercontent.com/u/10732888?v=4)](https://github.com/Elenthar "Elenthar (4 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (4 commits)")[![deefour](https://avatars.githubusercontent.com/u/14762?v=4)](https://github.com/deefour "deefour (4 commits)")[![VINICIUSOLIVER](https://avatars.githubusercontent.com/u/27225482?v=4)](https://github.com/VINICIUSOLIVER "VINICIUSOLIVER (4 commits)")

---

Tags

jsonapirestleague

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/softcomtecnologia-fractal/health.svg)

```
[![Health](https://phpackages.com/badges/softcomtecnologia-fractal/health.svg)](https://phpackages.com/packages/softcomtecnologia-fractal)
```

###  Alternatives

[league/fractal

Handle the output of complex data structures ready for API output.

3.5k64.1M476](/packages/league-fractal)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69114.3k](/packages/serpapi-google-search-results-php)[jsor/hal-client

A lightweight client for consuming and manipulating Hypertext Application Language (HAL) resources.

2425.9k1](/packages/jsor-hal-client)[elao/json-http-form-bundle

Adds support of JSON requests for Forms

356.0k](/packages/elao-json-http-form-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
