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

nnicola's avatar

Api gateway: How would you go for it?

Hello everyone, I manage some websites (around 15) which get data from different API providers. Every different API providers has some kind of rate limitation, so consuming that data from 15 websites directly is not doable anymore. So I start to feel the need of some sort of "man in the middle", which acts as an intermeediate/proxy collecting data from the different service providers, simply aggregating them, and forward directly, or with a minimum of further elaboration, to the websites clients. That would be my one and only "Api/data provider".

I'm not very experienced with this scenario but it looks like there is the need of what is technically called an "API gateway".

I did a bit of research and there are opensource and commercial solution for this.

At this point It seems to me I have 2 options:

  1. Going for a proper Api gateway solution.

Pro: using the right tools for the right job Cons: overwhelming?

  1. Build a simple API gateway by my self in Laravel.

Pros: I would work in my comfort zone (laravel), same technology for everything, full control. Cons: build from scratch, more complicated than it seems.

I would like to have some opinions because I really dont have experience with this and maybe I'm missing something.

Thanks in advance

0 likes
2 replies
martinbean's avatar

@nnicola What you’re describing is basically a proxy. Your 15 sites make a request to your proxy, and your proxy either forwards the request on to the end API, or returns a previously-cached response if appropriate.

I wouldn’t use Laravel for this because using a full-stack framework just for the sake of forwarding a HTTP request seems overkill. AWS has an API gateway service that’s imaginatively called API Gateway. If the end API uses HTTP cache headers appropriately then the gateway could probably leverage them. If App 1 makes a request and gets a response from the API, then that response could be cached so that when another App calls the same endpoint, they get the response cached from when App 1 made the request, instead of going out to the API again.

nnicola's avatar

@martinbean thanks, that is pointing me to the right direction: what if I will need to add some "business logic" to this Aws API gateway? For example, modify some responses, aggregate 2 different responses in one and so on?

Please or to participate in this conversation.