We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Run Async Task in background

https://docs.phalcon.io/en/latest/reference/cli.html

as in example $ php app/cli.php main test world universe

is there a "phalcon way" to execute a task as a background job from Controller? or to use

    shell_exec('php app/cli.php main test world universe')


6.9k
Accepted
answer

Queuing is probably the closest to what you're after. Currently only Beanstalk is supported (which runs as a daemon).

https://docs.phalcon.io/en/latest/reference/queue.html

Your controller would put a job in the queue, and the workers that you have running separately would process them when received.

Yea, i would definitely use beanstalkd queue too.

What is best beanstlkd lib that I could create something like https://laravel.com/docs/5.1/queues#running-the-queue-listener

What you mean ? Phalcon already has stuff like this, just mix phalcon cli and queue.

https://docs.phalcon.io/pl/latest/reference/cli.html