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

gouseferoz's avatar

Calling an API from a controller

Hi All,

i am trying to communicate with an external api that supports GET and POST requests and these API responses will be used inside my controller to do some more operations like saving it in DB or any such.

How can i implement this from inside a controller?

Code i was looking for is similar to this:


//This is not an actual code implementation

$api_call = HTTP("https://externalAPI.com/resource?name=feroz");
return $api_call['response'];


Can anyone point me in the right direction?

Regards, Feroz.

0 likes
3 replies

Please or to participate in this conversation.