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

galatta's avatar

Larvel view connecting to Laravel API

Our company follows an n-tier architecture (we have three servers: Web -> Api -> Db). The browser will communicate with the Web server, the web server will communicate with the API server, and the API server will query the DB server and pass the data in the reverse sequence to the browser. The browser should not directly communicate with the API server; it should go to the Web server and the Web server to the API server.

I will be building two apps in Laravel; one will be loaded in a web server (it contains views), and another is an API app, which will be loaded in the API server. The user has to be authenticated using SMAL to access the site.

How do we relay the query from the browser to the API server through the Web server for each view & model with the authenticated user? How do we pass the store, update, and delete requests from the browser to the API server through the Web server?

Any sample codes will be helpful.

0 likes
0 replies

Please or to participate in this conversation.