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

mecjos's avatar

What are the differeneces between Api Resource Response and Http Response

I wonder what are the main logic behind api resources except adding meta data to response.. And what are the differences between api resource collections and http json responses. I get same response when I get http json response by returning

return response()->json($model, 200)

with by returning

$jobModel;

return new JobResource($jobModel);

Where can I find usage examples and best practices for api resource collections?

0 likes
1 reply
UNITEAD's avatar
UNITEAD
Best Answer
Level 16

it's true it looks like the same but it's not really an API resource is highly customizable and has plenty of other options you can use like conditional relationships or conditional metadata also, you can change the response witch a thing I always do besides that you can reuse it everywhere else and you don't have to retype the format you want your response to look like I hope this helped

Please or to participate in this conversation.