Search by

borodulin / yii2-camunda

borodulin

The Camunda Rest API extension for the Yii2 framework

Package info

github.com/borodulin/yii2-camunda

Type:yii2-extension

pkg:composer/borodulin/yii2-camunda

Statistics

Installs: 84

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

1.0.1 2026-11-03 04:14 UTC

This package is auto-updated.

Last update: 2026-11-03 04:15:53 UTC


README

Latest Version Total Downloads CI License

Description

Client for the Camunda 7 BPM engine REST API for the Yii2 framework.

Covered resources: deployments, process definitions, process instances, tasks, executions, messages, signals, variable instances, migrations, authorizations and engines.

Tested in CI against Camunda 7.21.

Requirements

  • PHP 7.4 or 8.x
  • Yii 2.0.14 or newer (2.0.x) and yiisoft/yii2-httpclient
  • A running Camunda 7 engine with the REST API enabled

Installation

Install the extension via Composer:

composer require borodulin/yii2-camunda:^1.0

Configuration

Register the API client as the camunda application component:

'components' => [
    'camunda' => [
        'class' => \borodulin\camunda\CamundaApi::class,
        'apiUrl' => 'http://localhost:8080/engine-rest',
        // optional HTTP Basic authentication
        'username' => 'demo',
        'password' => 'demo',
    ],
],

If the component is not configured, a client with the default URL http://localhost:8080/engine-rest is used.

Usage

Each REST resource is represented by a class in the borodulin\camunda namespace. Errors returned by the engine are thrown as borodulin\camunda\Exception.

Deploy a process

use borodulin\camunda\Deployment;

$deployment = (new Deployment())->create('invoice', '/path/to/invoice.bpmn');

Camunda 7.20+ requires camunda:historyTimeToLive to be set on every deployed process.

Start a process instance

use borodulin\camunda\ProcessDefinition;

$definition = new ProcessDefinition();
$instance = $definition->startInstanceByKey('invoice', [
    'businessKey' => 'INV-123',
    'variables' => ProcessDefinition::translateVariables([
        'amount' => 100,
        'customer' => 'ACME',
    ]),
]);

translateVariables() converts plain PHP values into Camunda typed variables.

Work with user tasks

use borodulin\camunda\Task;

$task = new Task();
$tasks = $task->getList(['processInstanceBusinessKey' => 'INV-123']);

$task->claim($tasks[0]['id'], 'john');
$task->submitForm($tasks[0]['id'], ['approved' => true]);

Correlate a message

use borodulin\camunda\Message;

(new Message())->messageOne('paymentReceived', 'INV-123', ['paid' => true]);

Testing

The acceptance tests run against a real Camunda engine:

docker run -d -p 8080:8080 camunda/camunda-bpm-platform:7.21.0
composer install
CAMUNDA_API_URL=http://localhost:8080/engine-rest vendor/bin/codecept run

License

borodulin/yii2-camunda is released under the MIT License. See the bundled LICENSE for details.