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

mecjos's avatar

What is the difference between API Resource and Eloquent Collections

I am new on using Laravel api things. I'm trying to understand what's the differece between api resources and eloquent native collection results. It's not clear yet for me. I'm using postman to analyze data but I can't see huge diffrenece. As far as I see api resources just wrap with data tag all datas.. :) Most probably it's not like that. If someone guide me about the differences and advantages, I'll be so glad. Thank you.

0 likes
1 reply
s4muel's avatar
s4muel
Best Answer
Level 50

API Resource is a transformation layer. if you don't want to output eloquent models 1:1.

the data wrapping is also a plus, if you want to output previous/next... links and/or some other metadata in the result

1 like

Please or to participate in this conversation.