Phlow is a workflow modeller and engine for PHP. Heavily inspired by BPMN 2.0 and Apache Camel, Phlow attempts to provide a library to design and implement business processes in PHP projects. It utilises the notion of workflow to model a process of any kind, through which a piece of work passes from initiation to completion.
Phlow process models can be created using PHP. No third party tools are required to model and/or execute your process.
Phlow is a framework agnostic solution.
✅ Sequence flow
✅ Conditional flow
✅ Error handling
✅ Callbacks
✅ Boolean expressions for Conditions
✅ PSR/3 Logger integration
✅ Execution path replay
✅ Workflow model in plain/text format
✅ Execution path in plain/text format
See the Roadmap for more information about the upcoming releases.
The following image illustrates a simple process for dealing with a non-functioning lamp. Once a non-functioning lamp is found, the flow evaluates whether the lamp is plugged in. If not, it evaluates whether the lamp has been burned out. In any case, particular actions must be taken i.e. replace the lamp.
Also, the following code illustrates the model for the same process.
$builder = new WorkflowBuilder();
$builder
->start()
->choice()
->when('isPluggedIn')
->callback() // Plug in lamp
->when('isBurnedOut')
->callback() // Replace lamp
->otherwise()
->callback() // Repair lamp
->endAll()
Once the model bas been built, it can be executed by creating a new instance. At this point it is possible to pass some data that could be made available throughout the process. The data can be any object which could be also updated as part of the process.
$workflow = $builder->getWorkflow();
$instance = new WorkflowInstance($workflow, $data);
$instance->execute();
Phlow can be installed to your PHP project by executing the following composer command. Please note that currently there is no stable version yet available.
$ composer require softius/phlow 0.4.0
- Overview
- Workflow Model
- Workflow Engine
- Workflow Builder
- Sequence Flow - Example
- Conditional Flow - Example
- FAQs
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.