{"repo":"spatie/fractalistic","free":true,"listed":false,"github":"https://github.com/spatie/fractalistic","clone":"git clone https://github.com/spatie/fractalistic.git","description":"A framework agnostic, developer friendly wrapper around Fractal","language":"PHP","stars":385,"topics":["php","api","fractal","transform","json"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"A developer friendly wrapper around Fractal Fractal is an amazing package to transform data before using it in an API. Unfortunately working with Fractal can be a bit verbose. Using Fractal data can be transformed like this: This package makes that process a tad easier: There's also a very short syntax available to quickly transform data: If you want to use this package inside Laravel, it's recommend to use laravel-fractal instead. That package contains a few more whistles and bells specifically targetted at Laravel users. Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website. Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Install You can pull in the package via composer: Usage In the following examples were going to use the following array as example input: But know that any structure that can be looped (for instance a collection) can be used. Let's start with a simple transformation. This will return: In all following examples it's assumed that you imported the Spatie\\Fractalistic\\Fractal at the top of your php file. Instead of using a closure you can also pass a Transformer: You can ","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/fractalistic/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}