nick-bai / bpmplatform

PHP framework for workflow and process automation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latest Stable Version Build Status Minimum PHP Version License: MIT Scrutinizer Code Quality

About

BpmPlatform is a PHP framework for workflow and process automation. Its core consists of XML model, on top of which you can create custom models with domain-specific elements and relationships. It also implements BPMN model fully compatible with BPMN 2.0 specification.

Installation

Install BpmPlatform, using Composer:

composer require bingo-soft/bpmplatform

Running tests

./vendor/bin/phpunit ./tests

Example 1

//create new invoice business process

Bpmn::getInstance()->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::getInstance()->readModelFromStream($fd);

Acknowledgements

BpmPlatform draws inspiration from camunda library.

License

MIT

About

PHP framework for workflow and process automation

License:MIT License


Languages

Language:PHP 100.0%