Support the ongoing development of Laravel.io →
posted 4 years ago

Hey guys, I am going to use Laravel for the front-end of a project which offers a REST API for communicating with the back-end. I was wondering if there are any best practices on how to deal with consuming REST APIs. I know about the HTTP client, but I was wondering if I should use service provider for example for every API endpoint. Also, how do I deal with the response entities, do I just write my own classes and fill them based on the JSON data I receive from the API? Any hints on how to approach this scenario would be helpful.

Last updated 3 years ago.
0

Hello, Sebastian! You can use Guzzle http client with repository pattern. I think wich you don't need create de entities. I hope helped you.

smares liked this reply

1

Thanks, "repository pattern" was a helpful hint.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.