2017 © Pedro Peláez
 

library fractal

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

image

league/fractal

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

  • Thursday, April 26, 2018
  • by alexbilbie
  • Repository
  • 90 Watchers
  • 2538 Stars
  • 7,651,305 Installations
  • PHP
  • 343 Dependents
  • 48 Suggesters
  • 316 Forks
  • 78 Open issues
  • 35 Versions
  • 9 % Grown

The README.md

Fractal

Latest Version Software License The PHP League Tests Total Downloads, (*1)

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., (*2)

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., (*3)

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, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request., (*4)

Install

Via Composer, (*5)

``` bash $ composer require league/fractal, (*6)


## Requirements The following versions of PHP are supported by this version: >= PHP 7.4 ## 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 - add HAL serializers ## Testing ``` bash $ phpunit

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*7)

Maintainers

Credits

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

26/04 2018
12/06 2017
12/03 2017
28/12 2016

0.15.0

0.15.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

api json rest league

21/07 2016

0.14.0

0.14.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

api json rest league

07/10 2015

0.13.0

0.13.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

api json rest league

19/03 2015

0.12.0

0.12.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

api json rest league

10/12 2014

0.11.0

0.11.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

17/10 2014

0.10.0

0.10.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

16/09 2014

dev-mediaholding-improved-json-api-support

dev-mediaholding-improved-json-api-support http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

24/07 2014

dev-scrutinizer

dev-scrutinizer http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

06/07 2014

0.9.1

0.9.1.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

06/07 2014

0.9.0

0.9.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

06/07 2014

dev-improved-l4-paginator

dev-improved-l4-paginator http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

14/06 2014

0.8.3

0.8.3.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

09/06 2014

0.8.2

0.8.2.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

05/06 2014

0.8.1

0.8.1.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

27/05 2014

0.8.0

0.8.0.0 http://fractal.thephpleague.com/

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

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api json rest league

31/01 2014

0.7.0

0.7.0.0 https://github.com/thephpleague/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

24/01 2014

0.6.1

0.6.1.0 https://github.com/thephpleague/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

27/12 2013

0.6.0

0.6.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

13/12 2013

0.5.1

0.5.1.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

13/12 2013

0.5.0

0.5.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

13/12 2013

0.4.6

0.4.6.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

12/12 2013

0.4.5

0.4.5.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

11/12 2013

0.4.4

0.4.4.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

10/12 2013

0.4.3

0.4.3.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

10/12 2013

0.4.2

0.4.2.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

10/12 2013

0.4.0

0.4.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

09/12 2013

0.3.1

0.3.1.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

09/12 2013

0.3.0

0.3.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

09/12 2013

0.2.1

0.2.1.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

08/12 2013

0.2.0

0.2.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

08/12 2013

0.1.0

0.1.0.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league

27/11 2013

0.0.1

0.0.1.0 https://github.com/php-loep/fractal

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

  Sources   Download

MIT

The Development Requires

api json league