PHP code example of plata / fravel

1. Go to this page and download the library: Download plata/fravel 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/ */

    

plata / fravel example snippets


'providers' => [
  // ...
  'Plata\Fravel\FravelServiceProvider::class',
  // ...
]

'aliases' => [
  // ...
  ''Fractal' => \Plata\Fravel\Facade\Fractal::class',
  // ...
]

$resource = Fractal::collection(User::all(), $transformer);

return Response::fractal($resource);

$resource = Fractal::item(User::find(1), $transformer);

return Response::fractal($resource);
shell
php artisan make:transformer UserTransformer
shell
php artisan vendor:publish