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

Mfrancik's avatar

How to handle a long running request

I am using twilio to send 1000s of texts to a defined group of phone numbers. What is the best logic to follow when trying to achieve this?

is this a job which should be used with queues?

Can I send an ajax request to the method and allow the user to navigate elsewhere, will this process continue to run if page is reloaded?

0 likes
2 replies
Cronix's avatar
Cronix
Best Answer
Level 67

The answer to each of your questions, is yes. You set up a queue worker, or workers. Think of them as laravel running in the background all the time. Then you send jobs to them and they get processed in the background, even if the user closes their browser.

Mfrancik's avatar

Im a bit confused on how to do this.

1.) can I create a table with all needed information to send text? (to number, from number, message).

2.) have a job run to pull each record off the table, send message, delete record from table.

3.) next job runs and repeats....

Please or to participate in this conversation.