A Workflow is a sequence of steps that can be for example, performed by a user, and formally represented as a Petri Net or an oriented graph.
Let’s start with a simple example of an e-commerce software checkout workflow:
When the customer enters the checkout process, an order is created and he issues the payment.
Depending on the payment success (true or false), the execution will continue in one of the two branches (Exclusive Choice or XOR-split Workflow pattern).
If the payment failed, an error message is displayed and the user is sent back to the payment step.
If the payment is successful, the ‘Send confirmation e-mail’ and ‘Set order status to shipping’ tasks run in parallel or almost (Parallel Split or AND-split Workflow Pattern) and the checkout process ends when they are both finished (Synchronization or AND-join Workflow pattern).
This kind of system (graph definition and execution) already exists for some time.
I made researches about it and found a low level PHP Workflow engine developed by Sebastian Bergmann based on oriented graphs that I will integrate in the Joomla core.
The core supports already all the basic control flow patterns and is easily extensible.
A few special types of node allow, for example, the manipulation of workflow variables or the execution suspension waiting for input values to be provided to the engine.
I will at least write an abstraction layer for easier Workflow definitions programmatically, rewrite the database Workflow execution and storage with Joomla layer, add user knowledge and ACL to the engine, allow easy communication between MVC controllers and the execution engine and write unit tests with PHPUnit.
If time permits, I will write a Platform web application or CMS component to show it working.
The workflow engine can be used by e-commerce, content extensions in need of rigorous processes definition and execution, (multithreaded) Daemon applications running automated tasks in the background.