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

Dave97's avatar

How to implement Asynchronous or parallel call of API related task?

Hi, I have an external library implemented with synchronous curl call. But to fill my database regularly,i need to call around 40 API endpoints per hour with each being called around 100 times with different parameters. To reduce result time i would like to achieve asynchronous call on each endpoint but i dont want to modify this external library httpcall. What is the best way to call asynchronously different instances of this library?Is this the proper way to follow? I was trying with pthread or ampPhp but i am not even sure it can be used properly with Laravel (and how?)

0 likes
2 replies
Dave97's avatar

@Cronix Thanks to point me back to the right path of search...

From my reading (https://laravel.com/docs/5.6/queues , https://toniperic.com/2015/12/01/laravel-queues-demystified), I understand a worker can prioritize different queues, but for having different queues running in parallel, i will have to programmatically launch (not by CLI) different workers i.e in my case more than 40 workers for more than 40 different endpoints.

Do you know where to find documentation on how to programmatically create worker and how to evaluate the memory footprint (to understand which limitation exists in the number of worker)?

Please or to participate in this conversation.