bingo-soft / bpmn
Bpmn model used in workflow engine
Installs: 491
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.4 || ^8.0
- bingo-soft/xml: ^1.0
Requires (Dev)
README
bpmn
Bpmn model used in workflow engine
Installation
Install Bpmn, using Composer:
composer require bingo-soft/bpmn
Running tests
./vendor/bin/phpunit ./tests
Example 1
//create new invoice business process Bpmn::createProcess() ->executable() ->startEvent() ->name("Invoice received") ->formKey("embedded:app:forms/start-form.html") ->userTask() ->name("Assign Approver") ->formKey("embedded:app:forms/assign-approver.html") ->assignee("demo") ->userTask("approveInvoice") ->name("Approve Invoice") ->formKey("embedded:app:forms/approve-invoice.html") ->assignee('${approver}') ->exclusiveGateway() ->name("Invoice approved?") ->gatewayDirection("Diverging") ->condition("yes", '${approved}') ->userTask() ->name("Prepare Bank Transfer") ->formKey("embedded:app:forms/prepare-bank-transfer.html") ->candidateGroups("accounting") ->serviceTask() ->name("Archive Invoice") ->setClass("org.test.bpm.example.invoice.service.ArchiveInvoiceService") ->endEvent() ->name("Invoice processed") ->moveToLastGateway() ->condition("no", '${!approved}') ->userTask() ->name("Review Invoice") ->formKey("embedded:app:forms/review-invoice.html" ) ->assignee("demo") ->exclusiveGateway() ->name("Review successful?") ->gatewayDirection("Diverging") ->condition("no", '${!clarified}') ->endEvent() ->name("Invoice not processed") ->moveToLastGateway() ->condition("yes", '${clarified}') ->connectTo("approveInvoice") ->done();
Example 2
// Read business process from file $fd = fopen('test.bpmn', 'r+'); $modelInstance = Bpmn::readModelFromStream($fd);