Skip to content

Nayra is a BPMN workflow engine in PHP. Utilize it in your own projects to have your own complex workflow capabilities.

License

Notifications You must be signed in to change notification settings

wilsonDebug/nayra

 
 

Repository files navigation

ProcessMaker Nayra

ProcessMaker Nayra is a package that provides base classes to implement a process execution engine. This includes patterns to implement activities, events and gateways.

How to execute a process

Load a BPMN definition

        $bpmnRepository = new BpmnDocument();
        $bpmnRepository->setEngine($this->engine);
        $bpmnRepository->setFactory($this->repository);
        $bpmnRepository->load('files/ParallelGateway.bpmn');

ParallelGateway diagram

Get a reference to the process

        $process = $bpmnRepository->getProcess('ParallelGateway');

Create a data storage

        $dataStore = $this->repository->createDataStore();

Create a process instance

        $instance = $this->engine->createExecutionInstance($process, $dataStore);

Trigger the start event

        $start = $bpmnRepository->getStartEvent('StartEvent');
        $start->start($instance);

Start Event

Execute tokens and run to the next state

        $this->engine->runToNextState();

One token arrives to the first task

        $firstTask = $bpmnRepository->getScriptTask('start');
        $token = $firstTask->getTokens($instance)->item(0);

First task

Complete the first task

        $startActivity->complete($token);

Execute tokens and run to the next state

        $this->engine->runToNextState();

One token arrives to the second task and one to the third task

        $secondTask = $bpmnRepository->getScriptTask('ScriptTask_1');
        $token1 = $secondTask->getTokens($instance)->item(0);
        $thirdTask = $bpmnRepository->getScriptTask('ScriptTask_2');
        $token2 = $thirdTask->getTokens($instance)->item(0);

Second task and third task

License

ProcessMaker Nayra is open-sourced software licensed under the Apache 2.0 license.

About

Nayra is a BPMN workflow engine in PHP. Utilize it in your own projects to have your own complex workflow capabilities.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%