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

ramonsimon's avatar

Is there an example for a Laravel API using Laravel as back-end and front-end?

I'm looking for a way to connect Laravel to another Laravel server. One server functions as a database (API) and the other uses the API to access the database. I have no idea how to connect them. I'm still looking for a good example or tutorial.

0 likes
4 replies
mohamedallamthe1's avatar

there is a number of ways, but to make it easy for you, try to do http request from the client to the database api server where you fetch data as a json for example, there you go and can do treat the API one as a standalone API.

bait-dept's avatar

You've two services and you want them to communicate.

You can use HTTP (since you've an API it might be the easiest to implement) or you can use something like gRPC (then you get into the microservices world)

martinbean's avatar

@ramonsimon So why have you decided on that architecture if you don’t actually know how it would work in practice?

Please or to participate in this conversation.