Getting started with workflows in PHP

For a large project at work, we need to integrate or develop a workflow engine.  I worked a little bit with workflow engines in the past, but the subject is way to big and complex for me to claim any expertise in it.

So, I am looking at what’s available these days and what are our options.  This post is a collection of initial links and thoughts, and it’s goal is mostly to document my research process and findings, and not to provide any answers or solutions yet.

First things first.  What am I looking for?

  • PHP technology stack.  The project is in PHP, and all our in-house expertise is in PHP, so for now I’m not going to consider anything too far out.  Ideally, something for CakePHP framework.
  • Web-based user interface or configuration files.  We will need to provide clients with the way to manage the workflows, so either we need a web interface (ideally, for non-technical people), or at least some form of configuration files (most clients who will use it either have their own development teams or will use us to set things up and manage them later).
  • Open Source software.  The workflow engine will be embedded into our own projects and products, and at this time we don’t want to rely on proprietary options.  BSD or MIT licenses preferable.
  • Free.  This is not a hard requirement, but rather a nice to have.

The above is not workflow specific, but a general approach to evaluating components that we need.  Now for the workflow-specific things:

  • Process management.  We don’t have any hard requirements currently, but some use case scenarios include approvals (content publishing, purchasing, registrations, payments, and so on).
  • Versioning.  Any workflow that is defined and activated will eventually change.
  • Visualization.   In the ideal world, we’d have a visual editor to create and edit workflows, but at the very least, existing workflows should be presented in some visual form, like a graph or a chart.
  • Failures and re-runs.  Workflow runs will fail occasionally.  The solution should handle failures gracefully.  More so, it should allow to re-run either the full workflow or a part of it.  Re-runs should be supported for successful executions too, not just the failed ones.
  • Multiple trigger mechanisms.  Workflows can be triggered based on time (either on specific dates and times, periodically, or based on time since some conditions).  Data change (creating a new record, editing an existing one, etc) should be able to trigger a workflow run.  Also, workflow should be triggerable manually, as in the case above, with re-runs.
  • Flexible actions support.  Workflow actions should be easy to create, whether it’s a message sending, a webhook/web request, or something more specific.
  • Parallel execution.  There might be multiple workflows defined for the same record, and they might be executed in parallel, independently of each other.
  • Logging.  It should be crystal clear from the logs what triggered which workflow run, what was the status (success, failure), what was changed/done, etc.
  • Standard compliance.  If there are any standards in this domain, it’d be nice if the solution was compliant with them, in order to minimize the reinvention of the wheel and to increase the interoperability with other tools.

I think that’s enough for now.  The above might change as I learn more.

Before diving into any specific solutions and comparisons, it’d be nice to have a better understanding of what’s available and to get some terminology right.  As I said, I’m not an expert in this field, so for now even coming up with Google search terms is a challenge.  Let’s get some Wikipedia references here (some of these I’ve read, and some of these I’m still chewing up):

OK, so with the above, I’m starting to build up my terminology vocabulary and it’s easier to find things now.

From the get-go look at things, it seems that BPMN v2.0 is the standard to consider seriously.  While there are many workflow and business process management options to choose from, BPMN v2.0 engines are fewer and more clearly defined.

That’s more than enough theoretical material for the first time.  Let’s get a bit more practical.  What’s out there, especially in the PHP world?

It’s too early to make a decision yet, but if I had to right now, I’d probably go with Workflower, implementing a BPMN v2.0 approach.

 

 

 

One thought on “Getting started with workflows in PHP”

Leave a Comment