Laravel API Resources vs Fractal — Which Should You Use

Laravel API Resources and Fractal both transform models into JSON. Here's how they compare on flexibility, includes, performance, and team ergonomics.

Richard GamoraRichard GamoraFullstack developer·4 min read
LaravelAPIJSON

When you need consistent JSON output from a Laravel API, you have two reasonable choices: built-in Eloquent API Resources, or the third-party Fractal package. I have used both extensively. Here is how they actually compare in production use.

API Resources: built-in and good enough

API Resources ship with Laravel and integrate cleanly. You can transform a single model with new UserResource($user) or a collection with UserResource::collection($users). They support conditional attributes via $this->when() and let you nest other resources naturally.

For most APIs, this is everything you need. The syntax is familiar, the features cover the typical cases, and there is nothing to install or configure.

Fractal: more flexible includes

Fractal's main strength is dynamic includes — the client can request ?include=author,comments and only those relations are returned. The transformer pattern is clean, and Fractal handles serialization formats (JSON-API, data wrappers) more flexibly than API Resources.

If your API has many optional nested resources and clients control what they fetch, Fractal saves work. The trade-off is one more package to keep updated and a slightly different mental model from the rest of Laravel.

When to choose which

Use API Resources for most internal or single-client APIs. Use Fractal when you have multiple consumers requesting different shapes, or when you need strict JSON-API compliance. There is no real performance difference at typical scale — both compile down to similar query and serialization work.

Whichever you choose, commit to it across the codebase. Mixing the two is the worst outcome — half the routes have one shape, half have another, and the team has to remember which is which.

About the author

Richard Gamora

Richard Gamora

Fullstack developer based in the Philippines, working mostly with Laravel and Vue.js, with eight years of production experience across web and mobile.

me@richardgamora.comUpwork ↗

More on Laravel