phelixjuma/guiflow

GUIFlow is a no-code workflow builder

v3.1.13 2024-04-29 13:06 UTC

This package is auto-updated.

Last update: 2024-04-29 13:07:54 UTC


README

GUIFlow is a no-code workflow builder.

Check the documentation for more details

REQUIREMENTS

  • PHP >= 8
  • justinrainbow/json-schema
  • wyndow/fuzzywuzzy
  • From v2.*, we have additional requirements:
    • Swoole: This package only works after you have installed Swoole extension and enabled the extension in your php.ini configuration file.
    • PHP DAG

INSTALLATION

composer require phelixjuma/guiflow

USAGE

$data = [
    'customer_name' => 'Naivas',
    'delivery_location' => 'Kilimani',
    'items' => [
        ['name' => 'Capon Chicken', 'quantity' => 2,'uom' => 'KGS', 'unit_price' => 100]
    ],
    "delivery_date" => "2023-09-04"
];

$config = json_decode('[{
    "rule": "Split orders for different brands",
    "skip": "0",
    "description": "",
    "stage": "split_orders",
    "dependencies": [],
    "condition": {
      "path": "items.*.matched_value.PrincipalCode",
      "operator": "exists"
    },
    "actions": [
      {
        "stage": "split_items",
        "description": "",
        "dependencies": [],
        "skip":"0",
        "action": "function",
        "path": "",
        "function": "split",
        "args": {
          "split_path": "items",
          "criteria_path": "items.*.matched_value.PrincipalCode"
        }
      }
    ]
  }]');
  
class userDefinedFunctionsClass {
    // class that defines all user defined functions outside the package ecosystem. 
}

$udfObj = new userDefinedFunctionsClass();

$workflow = new Workflow($config, $udfObj);
$workflow->run($data, true); // set second parameter to true for parallel execution        

print_r($data); // this will show the modified data