Temporal worker process that supports Symfony application on PHP FPM

:wave: Hi,

I’m looking into introducing Temporal workflows in a web application with a PHP backend; specifically, the API layer is running on Symfony served via Nginx / PHP-FPM.

Our API layer has a number of long-running / background tasks that could serve as good initial candidates (e.g. CSV imports, integrations with 3rd party systems, etc.)

After reviewing the PHP SDK docs - foundations, at a high-level, two of the tasks I must do are the following:

  • Select a user-flow and Refactor/rewrite the backend logic to use workflows and activities.
  • :no_entry: Spawn a worker process to handle workflow/activity function executions
    :point_up_2: :grey_question: My question :grey_question: I want to confirm my understanding that spawning a PHP worker process capable of running my existing logic would be a signficant level of effort (LOE), because the existing backend logic has been tested on PHP-FPM (process-per-request model) whereas the PHP Temporal worker processes run on Roadrunner which uses a long-running application processes for handling requests. So, we would need to retrofit our application logic to work correctly on RoadRunner.

Does that sound correct? Can anyone from the PHP Temporal community provide any suggestions on how I might proceed?




This a correct assumption, you will have to make partial retrofit to run your application under roadrunner.

The workflows part shouldn’t be a problem since you most likely won’t have any code to port, this feature are unique to temporal itself.

As for activities, I recommend checking symfony/runtime and existing Symfony packages for temporal. While RR and FPM have different execution models, good framework such as Symfony will do most of heavy lifting to mitigate such differences.