I have a class in my Symfony 2.3 project that is doing some http requests and takes some time.
I would like to run this task as a background process, so that the server returns an answer to the client and the background process continues running.
Do you know how to do that in Symfony?
I found the Process Component: http://symfony.com/doc/current/components/process.html but I am not sure if I can run a class method from there.
A simple way to do this is to separate the heavy lifting from the response by using a queue and a symfony command to process the queue.
http://symfony.com/doc/current/components/console/introduction.html
Create a symfony command that processes the jobs added to a queue, then add the work to be done to the queue from your controller. The queue will probably be implemented as a database table of jobs.
That way you can return a success response to the user and run a cron job on the server regularly to process the work you require.