0

I have a 'laravel' server on the back end over time one of my API calls became very long

follow sample:

$tempRelatorios->RelatoriosZero = $this->RelatoriosZero($request);
    
$request->merge(['tipo' => 'vinculou']);
$tempRelatorios->RelatoriosUm = $this->RelatoriosUm($request);
    
$tempRelatorios->RelatoriosDois = $this->RelatoriosDois ($request);
    
$tempRelatorios->RelatoriosTres = $this->RelatoriosTres ($request);

$tempRelatorios->RelatoriosQuatro = $this->RelatoriosQuatro($request);

I would like to know if it would be possible to call these functions asynchronously(RelatoriosUm , RelatoriosDois ,etc) I can't make multiple api calls, all the answer needs to be in a single Json.

I imagine that the response time of this route could be much better if I ran all these functions simultaneously , in the end wait for them all to finish and send them in a return

return response()->json($tempRelatorios);

thank you so much who can help :)

Zak
  • 5,910
  • 2
  • 23
  • 46
  • Does this answer your question? [Asynchronous Function Call in PHP](https://stackoverflow.com/questions/14236296/asynchronous-function-call-in-php) – Brian Thompson Oct 04 '21 at 18:17

0 Answers0