GithubHelp home page GithubHelp logo

sumonst21 / fractal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thephpleague/fractal

0.0 1.0 0.0 2.29 MB

Output complex, flexible, AJAX/RESTful data structures.

Home Page: fractal.thephpleague.com

License: MIT License

Ruby 0.08% PHP 99.92%

fractal's Introduction

Fractal

Latest Version Software License The PHP League Tests Total Downloads

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

  • 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.

Install

Via Composer

$ composer require league/fractal

Requirements

The following versions of PHP are supported by this version:

>= PHP 7.4

Documentation

Fractal has full documentation, powered by Jekyll.

Contribute to this documentation in the gh-pages branch.

Todo

  • add HAL serializers

Testing

$ phpunit

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Maintainers

Credits

License

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

fractal's People

Contributors

philsturgeon avatar willishq avatar greydnls avatar grahamcampbell avatar localheinz avatar felixkiss avatar nyholm avatar matthewtrask avatar duythien avatar korvinszanto avatar ipalaus avatar samsonasik avatar vanbrabantf avatar marcaddeo avatar niden avatar webda2l avatar deefour avatar elliotfehr avatar elenthar avatar ceeram avatar bencorlett avatar flugg avatar jasonlewis avatar maximebeaudoin avatar sebastiandedeyne avatar rtler avatar jdreesen avatar trycatchjames avatar helmut avatar v-stein avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.