1. Go to this page and download the library: Download saad/fractal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
saad / fractal example snippets
php
// assume that Request Url = /countries?_data = \Saad\Fractal\Fractal::create($countries, new CountryTransformer());
// CountryTransformer will
php
// assume that Request Url = /countries?_data = \Saad\Fractal\Fractal::create($countries, new CountryTransformer(), null, 'name,iso');
// CountryTransformer will
php
// assume that Request Url = /countries?exclude=name,code,iso
$couintries = Country::all();
$transformed_data = \Saad\Fractal\Fractal::create($countries, new CountryTransformer(), null, null, 'name');
// CountryTransformer will exclude only name from defaultIncludes
php
$parser = Saad\Fractal\FractalRequestParser::getInstance();
// we can check the following
$parser->ub.country'); // true
$parser->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.