That is correct, it does not. That's how php works. And even if it did, it would return an empty response as it had not gotten a reply yet.
But you can do them concurrently https://laravel.com/docs/9.x/http-client#concurrent-requests
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone. The reason for my email is to consult you regarding the handling of http requests in Laravel. How does laravel handle API response time?
As you can see, 2 requests are executed and then the Laravel server responds. My question is, does Laravel not execute the response ( " return response()-> " ) until it gets the information from the Http request?
This is the controller method:
public function check_user (Request $request){
$validated = $this->validate($request, [
'user' => 'required',
]);
$response_actor = Http::withHeaders([
'Authorization' => 'Bearer token',
])->get('http://somedomain:8000);
$response_user = Http::withHeaders([
'Authorization' => 'Bearer token',
])->get(' http://somedomain2:8000 );
return response()->json([
'status' => true,
'user' => $response_user,
'actor'=>$response_actor ,
], 201);
}
Please or to participate in this conversation.