PHP. How to make a queue?

There is a base entity, which needs to update once a day. There are APIs which can be accessed not more than 1 time per second. Choose all entities in the cycle are turning to the IPA, but the server responds differently, sometimes with a delay, and sometimes instantly, therefore, to obtain the error limit is reached, at the end of each iteration call sleep(1).
What tools and in what way you can make the queries were sent once per second, and if the first is not processed until the end, then run parallel to the second and etc?
July 8th 19 at 16:12
2 answers
July 8th 19 at 16:14
Look at cron
July 8th 19 at 16:16
PHP practically nothing.
It is possible in principle to find a descent walk-around.
Take the main script, it will be consumer - Ohm in the queue.
Him come task from the queue.
make a loop (pseudo code)
while(true)
get_next_message()
shell_exec('sender.php > /dev/null');
sleep(1);

Him times a second pull another script which will make a request to the API and perform any action.
So the OS itself will create the threads. a consumer will not wait for the end of the execution of a script (output to /dev/null ).

You can still work some magic with a fork (but the fork script after useful work(query) self end with 0. otherwise the overflow to happen and the server dies.

But better still or put up with delays, or use something that supports the same flows.
Java, C++, Python, etc.

Find more questions by tags PHPLaravel