Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

xtomp's avatar
Level 1

What is api resources

When building an API, you may need a transformation layer that sits between your Eloquent models and the JSON responses that are actually returned to your application's users. Laravel's resource classes allow you to expressively and easily transform your models and model collections into JSON.

0 likes
1 reply
bobbybouwmann's avatar

In other frameworks, they might be called transformers. Basically they are an array map of your model especially set up to be returned as JSON for an API.

I would say just give it a go and create one. The documentation has pretty clear examples as well.

Please or to participate in this conversation.