PHP code example of camundity / phpzeebe

1. Go to this page and download the library: Download camundity/phpzeebe library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

camundity / phpzeebe example snippets


use Camundity\PhpZeebe\ZeebeWorker;

class SelectAssigneeWorker extends ZeebeWorker {
	
	public function __construct($zeebeClient) {
		parent::__construct($zeebeClient);
		$this->setType("selectAssignee");
    }
	
	
	public function executeTask($activatedJob){
		$variables = $this->getVariables($activatedJob);
		var_dump($variables);
		$variables["assignee1"] = "toto";
		$this->complete($activatedJob, $variables);
	}
}


use Camundity\PhpZeebe\ZeebeClient;

$client = new ZeebeClient("XXX");
$client->saasAuth("XXX", "XXX");

$client->deployProcess("camunda-process.bpmn");

$client->runInstance("camunda-process2","latest", ["var1"=>"something"]);
$client->publishMessage("messageName","correlationKey", ["var2"=>"someOtherValue"]);

$worker2 = new MailWorker($client);
$worker2->work();
$worker = new SelectAssigneeWorker($client);
$worker->workLoop(); //blocking thread