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

Steph's avatar
Level 1

Is it safe to make sleep-recursive calls in Laravel API ?

Hello from France everyone !

I am actually running a CRON successfully calling a Laravel API endpoint every minute. Today, my project owner told me that he'd like that endpoint to be called one time every 5 seconds. CRON and Laravel Task Manager being not able to achieve that, I was thinking about calling 12 times recursively the said endpoint function with a time_sleep_until interval between each calls.

The problem is that I am not sure how Laravel/PHP process PHP scripts. Will that "one full minute running script" block the entire Laravel API server ? Or do each API call run in its own memory/program segment (whatever those are called in PHP world - sorry, I'm new in PHP ^^)

Thank you very much in advance !

0 likes
2 replies
Steph's avatar
Level 1

RhoooOOOOO, that seems EXACTLY what I was looking for ! Thank you SO MUCH Snapey ! I'll have a deeper look on it and won't hesitate to come back to this very thread if I have more related concerns :)

Please or to participate in this conversation.