Last night finally introduced what can be the beginning of replacing when developing APIs on Laravel 5.5. This is my first trial-and-run at it. Taylor Otwell Fractal The interesting stuff starts at step 4. 1- Install clean Laravel 5.5 project composer create-project laravel/laravel responses dev-developcd responsestouch database/database.sqlitephp artisan make:model Post -mfaphp artisan make:resource UsersWithPostsResourcephp artisan make:resource PostsResourcephp artisan make:controller UsersController --resource Change your file to use SQLite and remove every other database variable. .env DB_CONNECTION=sqlite 2- Prepping the database The posts migration database/migrations/______create_posts_table.php Schema:: ('posts', (Blueprint $table) {$table->increments('id');$table->string('title');$table->string('body');$table->unsignedInteger('user_id');$table->timestamps();}); create function The Post Factory database/factories/PostFactory.php **<?php use** Faker\Generator Faker; as $factory->define(App\Post:: , (Faker $faker) { ['title' => $faker->sentence,'body' => $faker->paragraph,'user_id' => () { factory(\App\User:: );}];}); class function return function return class The User has Posts relationship app/User.php posts(){ $this->hasMany(Post:: );} public function return class Avoid Mass Assignment on Posts app/Post.php **<?php namespace** App; Illuminate\Database\Eloquent\Model; use Post Model{ $guarded = [];} class extends protected Seeding the database php artisan migrate:freshphp artisan tinkerfactory(App\Post::class)->times(2)->create();factory(App\Post::class)->times(2)->create(['user_id' => 1]); 3- Setup the Route Route:: ('/users', 'UsersController'); apiResource 4- Transforming Model into a Resource _\Illuminate\Http\Response*/_ index(User $user){ UsersWithPostsResource($user->paginate());} /*** Display a listing of the resource.** @param User $user* @return public function return new 5- Users With Posts Resource **<?php namespace** App\Http\Resources; Illuminate\Http\Resources\Json\Resource; use UsersWithPostsResource Resource{ toArray($request){// Eager load$this->resource->load('posts'); class extends /*** Transform the resource into an array.** @param \Illuminate\Http\Request* @return array*/ public function **return** $this->resource->map(**function** ($item) { **return** \[ 'name' => $item->name, 'email' => $item->email, 'posts' => **new** PostsResource($item->posts) \]; }); } } 6- Posts Resource **<?php namespace** App\Http\Resources; Illuminate\Http\Resources\Json\Resource; use PostsResource Resource{ toArray($request){ $this->resource->map( ($item) { ['title' => $item->title];});}} class extends /*** Transform the resource into an array.** @param \Illuminate\Http\Request* @return array*/ public function return function return 7- Conclusion The first clear difference when comparing to is that the resource have easy and direct access to the whole collection instead of a per-object basis. This means that when transforming a collection of , you can easily eager load every without N+1 queries. Fractal Users post It is also easy to nest transformation since you can just spawn a new Resource class that will transform your data as needed. I expect to write a more detailed post about it once I start digging more into the possibilities. Followup This was the first article on API Resources coming to Laravel 5.5. You can find the 2nd article on this subject here: https://medium.com/@deleugpn/reusable-api-resource-with-nested-relationship-laravel-5-5-c654c7243869