PHPackages                             skrip42/node-processor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. skrip42/node-processor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

skrip42/node-processor
======================

Node processor

v1.0(6y ago)23MITPHPPHP ^7.1.3

Since Jan 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Skrip42/NodeProcessor)[ Packagist](https://packagist.org/packages/skrip42/node-processor)[ Docs](https://github.com/Skrip42/NodeProcessor)[ RSS](/packages/skrip42-node-processor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

NodeProcessor
=============

[](#nodeprocessor)

Description
-----------

[](#description)

Node Process is a small procedural like program executable on top of php.

Installing
----------

[](#installing)

composer require skrip42/node-processor

Documentation
-------------

[](#documentation)

- [Node process](https://github.com/Skrip42/NodeProcessor#node-process)
    - [Base usage](https://github.com/Skrip42/NodeProcessor#base-usage)
        - [Create process](#create-process)
        - [Running process and debug](#running-process-and-debug)
        - [Serialize/deserialize process](https://github.com/Skrip42/NodeProcessor#serializedeserialize-process)
    - [Process builder](#process-builder)
    - [Request/Response](#requestresponse)

- [ComonNodes](https://github.com/Skrip42/NodeProcessor#comonnodes)
    - [Manager nodes](https://github.com/Skrip42/NodeProcessor#manager-nodes)
        - [BeginNode](https://github.com/Skrip42/NodeProcessor#beginnode)
        - [EndNode](https://github.com/Skrip42/NodeProcessor#endnode)
        - [SplitterNode](https://github.com/Skrip42/NodeProcessor#splitterNode)
        - [SingleNode](https://github.com/Skrip42/NodeProcessor#singleNode)
        - [WaitingNode](https://github.com/Skrip42/NodeProcessor#waitingNode)
        - [TriggerNode](https://github.com/Skrip42/NodeProcessor#triggerNode)
        - [IterateNode](https://github.com/Skrip42/NodeProcessor#iterateNode)
        - [PauseNode](https://github.com/Skrip42/NodeProcessor#pausenode)
        - [RepeatNode](https://github.com/Skrip42/NodeProcessor#repeatnode)
        - [SubprocessNode](https://github.com/Skrip42/NodeProcessor#subprocessnode)
        - [MultiSubProcessNode](https://github.com/Skrip42/NodeProcessor#multisubprocessnode)
    - [Logical nodes](https://github.com/Skrip42/NodeProcessor#logical-nodes)
        - [AndNode](https://github.com/Skrip42/NodeProcessor#andnode)
        - [NotNode](https://github.com/Skrip42/NodeProcessor#notnode)
        - [OrNode](https://github.com/Skrip42/NodeProcessor#ornode)
        - [XorNode](https://github.com/Skrip42/NodeProcessor#xornode)
        - [CompareNode](https://github.com/Skrip42/NodeProcessor#comparenode)
    - [Arithmetical nodes](https://github.com/Skrip42/NodeProcessor#arithmetical-nodes)
        - [DivideNode](https://github.com/Skrip42/NodeProcessor#dividenode)
        - [ModNode](https://github.com/Skrip42/NodeProcessor#modnode)
        - [MultiptyNode](https://github.com/Skrip42/NodeProcessor#multiptynode)
        - [SubstractNode](https://github.com/Skrip42/NodeProcessor#substractnode)
        - [SumNode](https://github.com/Skrip42/NodeProcessor#sumnode)
    - [String nodes](https://github.com/Skrip42/NodeProcessor#string-nodes)
        - [ConcatNode](https://github.com/Skrip42/NodeProcessor#concatnode)
        - [MatchNode](https://github.com/Skrip42/NodeProcessor#matchnode)
        - [ReplaceNode](https://github.com/Skrip42/NodeProcessor#replacenode)
    - [Array nodes](https://github.com/Skrip42/NodeProcessor#array-nodes)
        - [Collect node](https://github.com/Skrip42/NodeProcessor#collectnode)
        - [Combine node](https://github.com/Skrip42/NodeProcessor#combinenode)
        - [Count node](https://github.com/Skrip42/NodeProcessor#countnode)
        - [Each node](https://github.com/Skrip42/NodeProcessor#eachnode)
        - [Extract node](https://github.com/Skrip42/NodeProcessor#extractnode)
    - [Other nodes](https://github.com/Skrip42/NodeProcessor#other-nodes)
        - [CounterNode](https://github.com/Skrip42/NodeProcessor#counternode)
        - [DumpNode](https://github.com/Skrip42/NodeProcessor#dumpNode)
        - [RandNode](https://github.com/Skrip42/NodeProcessor#randNode)
        - [RangeNode](https://github.com/Skrip42/NodeProcessor#rangeNode)
        - [ValueNode](https://github.com/Skrip42/NodeProcessor#valueNode)
- [Creating user node](https://github.com/Skrip42/NodeProcessor#creating-user-node)
    - [Input/output defenition](https://github.com/Skrip42/NodeProcessor#inputoutput-defenition)
    - [Read input/output, emit signals](https://github.com/Skrip42/NodeProcessor#read-inputoutput-emit-signals)
    - [Request/response processing](https://github.com/Skrip42/NodeProcessor#requestresponse-processing)

### Node Process

[](#node-process)

Node Process is a small procedural like program executable on top of php. The process consists of nodes and the connections between them, as well as the state of these nodes An important consequence of this: At any time, the process can be stopped, saved with the current state and continue to execute from the same point. Processes can be dynamically created using PHP, serialize, deserialize.

#### Base usage

[](#base-usage)

Add

```
use Skrip42\NodeProcessor\Process;
```

on top of your file. You can also add all the nodes that you intend to use:

```
use Skrip42\NodeProcessor\Node\Other\ValueNode;
use Skrip42\NodeProcessor\Node\Logical\CompareNode;
```

##### Create process

[](#create-process)

This section is presented to understand the processes, the recommended way to create processes is [process builder](https://github.com/Skrip42/NodeProcessor#process-builder).

```
$process = new Process; //create new process;

//create all necessary nodes:
// as syntax: process->createNode($nodeClassName, ...$values) : NodeAbstract
$valNode1 = $process->createNode(ValueNode::class, 1); //you can pass start parameters to the node if required
$valNode2 = $process->createNode(ValueNode::class, 5);
$compareNode = $process->createNode(ValueNode::class);
//You do not need to create a start and end node, they are already included in the process

//link nodes:
// as syntax: process->linkNode($outputNodeName, $outputNode, $inputNodeName, $inputNode)
$process->linkNode('out1', $process->getBeginNode(), 'emit', $valNode1); // you can get begin and end node
                                                                        // from getBeginNode and getEndNode methods
$process->linkNode('out2', $process->getBeginNode(), 'emit', $valNode2);
$process->linkNode('out', $valNode1, 'in1', $compareNode);
$process->linkNode('out', $valNode2, 'in2', $compareNode);
$process->linkNode('more', $compareNode, 'more', $process->getEndNode()); // end node has dynamically input name
$process->linkNode('less', $compareNode, 'less', $process->getEndNode());
//You can always leave output nodes empty; can input be left blank determined by node policy
```

The resulting process can be represented graphically:

```
                        ┌───────────────┐
                  ┌─emit┤ ValueNode = 1 ├out─┐    ┌─────────────┐            ┌─────────┐
┌───────────┐     │     └───────────────┘    └─in1┤             ├more────more┤         │
│           ├out1─┘                               │             │            │ EndNode │
│ BeginNode │                                     │ CompareNode ├less────less┤         │
│           ├out2─┐                               │             │            └─────────┘
└───────────┘     │     ┌───────────────┐    ┌─in2┤             ├equal─X
                  └─emit┤ ValueNode = 5 ├out─┘    └─────────────┘
                        └───────────────┘

```

Most nodes have one or more inputs and outputs. The names of the inputs and outputs of standard bonds can be found in the [documentation](https://github.com/Skrip42/NodeProcessor#comonnodes)

##### Running process and debug

[](#running-process-and-debug)

For start process:

```
$result = $process->run(); // running process
$state = $process->getState(); // you also can get current process state for debug you script
```

You will get array of the form:

```
[
    'status' => currentProcessStatus,
    'output' => [ .. array of end node inputs .. ]
    'requests' =>  [ .. array of requests .. ]
]
```

status is number indicating the current state of the process

- Process::STATUS\_REDY - redy to run
- Process::STATUS\_RUNN - running
- Process::STATUS\_ERROR - complete with error
- Process::STATUS\_WAIT\_RESPONSE - wait response (see [Request/Response](#requestresponse))
- Process::STATUS\_COMPLETE - complete

output is array of EndNode inputs. Input name map to array key.

requests is array of request (see [Request/Response](#requestresponse))

$process-&gt;getState() - return current state of process, all process nodes, all nodes inputs and outputs After the node identifier and the names of its inputs and outputs, you can see the number of starts of the nodes, how many times each input received a signal and how many times each output emitted a signal

##### Serialize/deserialize process

[](#serializedeserialize-process)

You can serialize and deserialize process as default php tools:

```
$serialized = serialize($process);
$process = unserialize($serialized);
```

**You should not include other objects in the nodes or pass from as parameters if you do not want to serialize them!**

#### Process builder

[](#process-builder)

A more convenient way to create a process is through the process builder. The previous process could be created like this:

```
$process = Process::build(
    [
        'node' => [
            'vn1' => [ValueNode::class, 1],
            'vn2' => [ValueNode::class, 5],
            'cn' => [CompareNode::class],
        ],
        'link' => [
            ['out1', 'begin', 'emit', 'vn1'], //begin is the predefined start node name
            ['out2', 'begin', 'emit', 'vn2'],
            ['out', 'vn1', 'in1', 'cn'],
            ['out', 'vn2', 'in2', 'cn'],
            ['less', 'cn', 'less', 'end'], //end is the predefined end node name
            ['more', 'vn2', 'more', 'end'],
        ]
    ]
);
```

using the builder you can also parameterize your process:

```
$process = Process::build(
    [
        'node' => [
            'vn1' => [ValueNode::class, '{$val1}'], // template syntax: {$valueName}
            'vn2' => [ValueNode::class, '{$val2}'],
            'cn' => [CompareNode::class],
        ],
        'link' => [
            ['out1', 'begin', 'emit', 'vn1'], //begin is the predefined start node name
            ['out2', 'begin', 'emit', 'vn2'],
            ['out', 'vn1', 'in1', 'cn'],
            ['out', 'vn2', 'in2', 'cn'],
            ['less', 'cn', 'less', 'end'], //end is the predefined end node name
            ['more', 'vn2', 'more', 'end'],
        ]
    ],
    [ //value list
        'val1' => 1,
        'val2' => 5
    ]
);
```

#### Request/Response

[](#requestresponse)

To communicate external code in the processes provided request/response system Some node can send request to process. Then the process will return with the status “waiting for a response” and as a result there will be a list of requests of the form:

```
[
    ['uniqIdOfRequest' => 'request data'],
    .......
]
```

You can send an answer like:

```
$process->setResponse('uniqIdOfRequest', 'response data');
```

Then the process will continue to execute from the node that sent the request (from node "setResponse" method)

### Nodes

[](#nodes)

Nodes are the buildeing blocks of processes. Most nodes have one or more inputs and outputs. Input can be 'required' then node cannot run without this input received. Input and output can be dynamically declaration (as pattern or free). Output can have default value. Input and output sored their values. Input and output have a start counter. Nodes run after all required input received. Nodes run everytime when any input received if all required input has value. Nodes can be force running from eval() method (no recommended). Nodes can emit request and receive response.

The module provides a sume number of base nodes:

- [Manager nodes:](https://github.com/Skrip42/NodeProcessor#manager-nodes) base thread controll
- [Logical nodes:](https://github.com/Skrip42/NodeProcessor#logical-nodes) base logical operation
- [Arithmetical nodes:](https://github.com/Skrip42/NodeProcessor#arithmetical-nodes) base arithmetical operation
- [String nodes:](https://github.com/Skrip42/NodeProcessor#string-nodes) base string operation
- [Array nodes:](https://github.com/Skrip42/NodeProcessor#array-nodes) base array operation
- [Other nodes:](https://github.com/Skrip42/NodeProcessor#other-nodes) base value emitrs, debug, counters You also can declaration [user node](https://github.com/Skrip42/NodeProcessor#creating-user-node)

### ComonNodes

[](#comonnodes)

#### Manager nodes

[](#manager-nodes)

##### BeginNode

[](#beginnode)

###### Description:

[](#description-1)

Start node, executed when the process starts

###### Parametrs:

[](#parametrs)

- mixed value = true

###### Grapical:

[](#grapical)

```
 ┌─────────────┐
 │             ├─ out1
 │             │
 │             │
 │             ├─ out2
 │  BeginNode  │
 │             │
 │             ├─ ...
 │             │
 │             │
 │             ├─ out$n
 └─────────────┘

```

###### Inputs:

[](#inputs)

none

###### Outputs:

[](#outputs)

- one or more outputs by pattern out{number}

###### Requests:

[](#requests)

none

###### Logic:

[](#logic)

emit $value from all outputs

##### EndNode

[](#endnode)

###### Description:

[](#description-2)

End node, collect result of process

###### Parametrs:

[](#parametrs-1)

none

###### Grapical:

[](#grapical-1)

```
      ┌───────────────┐
in1  ─┤               │
      │               │
in2  ─┤               │
      │    EndNode    │
...  ─┤               │
      │               │
in$n ─┤               │
      └───────────────┘

```

###### Inputs:

[](#inputs-1)

- some count of any value with any names

###### Outputs:

[](#outputs-1)

none

###### Requests:

[](#requests-1)

none

###### Logic:

[](#logic-1)

Collect all input value and map it to process result array. Input can haw any names, this names map to result array key.

##### SplitterNode

[](#splitternode)

###### Description:

[](#description-3)

Forked process trates

###### Parametrs:

[](#parametrs-2)

none

###### Grapical:

[](#grapical-2)

```
     ┌───────────────┐
     │               ├─ out1
     │               │
     │               ├─ out2
in  ─┤  SplitterNode │
     │               ├─ ...
     │               │
     │               ├─ out$n
     └───────────────┘

```

###### Inputs:

[](#inputs-2)

- in - required any type

###### Outputs:

[](#outputs-2)

- eny count of value with name like pattern: out{number}

###### Requests:

[](#requests-2)

none

###### Logic:

[](#logic-2)

emit input value to all outputs out1 = out2 = ... = out$n = in

##### SingleNode

[](#singlenode)

###### Description:

[](#description-4)

singlify input signals

###### Parametrs:

[](#parametrs-3)

none

###### Grapical:

[](#grapical-3)

```
       ┌───────────────┐
in    ─┤               │
       │   SingleNode  ├─ out
reset ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-3)

- in - required any type
- reset - any value to reset input lock

###### Outputs:

[](#outputs-3)

- out - equal first of in

###### Requests:

[](#requests-3)

none

###### Logic:

[](#logic-3)

emit output signal only for first time input signal

##### WaitingNode

[](#waitingnode)

###### Description:

[](#description-5)

Waiting emit signal for continue

###### Parametrs:

[](#parametrs-4)

none

###### Grapical:

[](#grapical-4)

```
      ┌───────────────┐
in   ─┤               │
      │  WaitingNode  ├─ out
emit ─┤               │
      └───────────────┘

```

###### Inputs:

[](#inputs-4)

- in - required any type
- reset - required bool

###### Outputs:

[](#outputs-4)

- out - equal in

###### Requests:

[](#requests-4)

none

###### Logic:

[](#logic-4)

emit outputs only if 'emit' signal = true

##### TriggerNode

[](#triggernode)

###### Description:

[](#description-6)

emit additional signals when input signal received

###### Parametrs:

[](#parametrs-5)

none

###### Grapical:

[](#grapical-5)

```
      ┌───────────────┐
      │               ├─ before
      │               │
in   ─┤  TriggerNode  ├─ out
      │               │
      │               ├─ after
      └───────────────┘

```

###### Inputs:

[](#inputs-5)

- in - required any type

###### Outputs:

[](#outputs-5)

- before - true
- out - equal in
- after - true

###### Requests:

[](#requests-5)

none

###### Logic:

[](#logic-5)

emit 'before'=true output when input received, before output emitted emit 'out' = 'in' emit 'after'=true output when input received, after output emitted

##### IterateNode

[](#iteratenode)

###### Description:

[](#description-7)

iterate array for each 'emit' signal received

###### Parametrs:

[](#parametrs-6)

none

###### Grapical:

[](#grapical-6)

```
        ┌───────────────┐
array  ─┤               ├─ out
        │               │
emit   ─┤  IterateNode  ├─ complete
        │               │
reset  ─┤               ├─ count
        └───────────────┘

```

###### Inputs:

[](#inputs-6)

- array - required array
- emit - required any type
- reset - reset control

###### Outputs:

[](#outputs-6)

- out - any type value (emit for each elements of 'array')
- complete - true (emit when array is end)
- count - count of 'array' elements (emit when 'array' signal received)

###### Requests:

[](#requests-6)

none

###### Logic:

[](#logic-6)

emit 'count' = count(array) signal when 'array' signal received emit 'out' = array\[$n\] for each 'emit' signal received emit 'complete' = true when 'array' is end

##### PauseNode

[](#pausenode)

###### Description:

[](#description-8)

Stop current thread until a response is received

###### Parametrs:

[](#parametrs-7)

none

###### Grapical:

[](#grapical-7)

```
      ┌───────────────┐
      │               │
 in  ─┤   PauseNode   ├─ out
      │               │
      └───────────────┘

```

###### Inputs:

[](#inputs-7)

- in - required any type

###### Outputs:

[](#outputs-7)

- out - any type value equal 'in'

###### Requests:

[](#requests-7)

- 'pause': waiting eny response

###### Logic:

[](#logic-7)

Stop current thread until a response is received then forward input to output

##### RepeatNode

[](#repeatnode)

###### Description:

[](#description-9)

Repeat 'in' sume time

###### Parametrs:

[](#parametrs-8)

$value - count of repeat time

###### Grapical:

[](#grapical-8)

```
      ┌───────────────┐
      │               ├─ out
 in  ─┤   RepeatNode  │
      │               ├─ complete
      └───────────────┘

```

###### Inputs:

[](#inputs-8)

- in - required any type

###### Outputs:

[](#outputs-8)

- out - any type value equal 'in'
- complete - true (emit when repeat end)

###### Requests:

[](#requests-8)

none

###### Logic:

[](#logic-8)

Forward input to output and repeat it '$value' time. Emit complete = true when repeat time is end

##### SubprocessNode

[](#subprocessnode)

###### Description:

[](#description-10)

Run subprocess (another instance of Process) inside node

###### Parametrs:

[](#parametrs-9)

$subprocessScheme like [process builder](https://github.com/Skrip42/NodeProcessor#process-builder)

###### Grapical:

[](#grapical-9)

```
       ┌─────────────────────┐
 in1  ─┤                     ├─ out1
       │                     │
 in2  ─┤                     ├─ out2
       │    SubProcessNode   │
 ...  ─┤                     ├─ ...
       │                     │
 in$n ─┤                     ├─ ount$n
       └─────────────────────┘

```

###### Inputs:

[](#inputs-9)

Depending on the scheme Map inputs to scheme parameters

###### Outputs:

[](#outputs-9)

Depending on the scheme Map subprocess output to node output

###### Requests:

[](#requests-9)

Forward request from subprocess Forward response to subprocess

###### Logic:

[](#logic-9)

Run subprocess (instance of Process) inside SubProcessNode, Map inputs to subprocess scheme parameters and map output of subprocess to current output Forward subprocess request and response Emit all output when subprocess status is Process::STATUS\_COMPLETE

##### MultiSubProcessNode

[](#multisubprocessnode)

###### Description:

[](#description-11)

Run sume fork of subprocess (another instance of Process) inside node

###### Parametrs:

[](#parametrs-10)

$subprocessScheme like [process builder](https://github.com/Skrip42/NodeProcessor#process-builder)

###### Grapical:

[](#grapical-10)

```
       ┌─────────────────────┐
 in1  ─┤                     ├─ out1
       │                     │
 in2  ─┤                     ├─ out2
       │ MultiSubProcessNode │
 ...  ─┤                     ├─ ...
       │                     │
 in$n ─┤                     ├─ ount$n
       └─────────────────────┘

```

###### Inputs:

[](#inputs-10)

Depending on the scheme Map simple inputs to scheme parameters Map each element of array inputs to appropriate number of subprocess

###### Outputs:

[](#outputs-10)

Depending on the scheme Map collected subprocesses outputs (as array)

###### Requests:

[](#requests-10)

Forward request from subprocesses Forward response to subprocesses

###### Logic:

[](#logic-10)

Run subprocess instance for each array element of greatest input value Collect all subprocesses outputs as appropriate arrays and map it to output forward all subprocesses request to node request forward all node response to subprocesses response emit all output when all subprocesses status is Process::STATUS\_COMPLETE

#### Logical nodes

[](#logical-nodes)

##### AndNode

[](#andnode)

###### Description:

[](#description-12)

Logical AND node

###### Parametrs:

[](#parametrs-11)

none

###### Grapical:

[](#grapical-11)

```
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │    AndNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-11)

- some inputs names like pattern 'in{$number}' - required boolean

###### Outputs:

[](#outputs-11)

- out - logical AND of all inputs
- iout - inverted out

###### Requests:

[](#requests-11)

none

###### Logic:

[](#logic-11)

'out' = 'in1' &amp;&amp; 'in2' &amp;&amp; ... &amp;&amp; 'in$n' 'iout' = !'out'

##### NotNode

[](#notnode)

###### Description:

[](#description-13)

Logical NOT node

###### Parametrs:

[](#parametrs-12)

none

###### Grapical:

[](#grapical-12)

```
      ┌───────────────┐
      │               │
 in  ─┤   CountNode   ├─ out
      │               │
      └───────────────┘

```

###### Inputs:

[](#inputs-12)

- in - required boolean

###### Outputs:

[](#outputs-12)

- out - logical NOT of input

###### Requests:

[](#requests-12)

none

###### Logic:

[](#logic-12)

'out' = !'in'

##### OrNode

[](#ornode)

###### Description:

[](#description-14)

Logical OR node

###### Parametrs:

[](#parametrs-13)

none

###### Grapical:

[](#grapical-13)

```
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │     OrNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-13)

- some inputs names like pattern 'in{$number}' - required boolean

###### Outputs:

[](#outputs-13)

- out - logical AND of all inputs
- iout - inverted out

###### Requests:

[](#requests-13)

none

###### Logic:

[](#logic-13)

'out' = 'in1' || 'in2' || ... || 'in$n'

##### XorNode

[](#xornode)

###### Description:

[](#description-15)

Logical XOR node

###### Parametrs:

[](#parametrs-14)

none

###### Grapical:

[](#grapical-14)

```
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │    XorNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-14)

- some inputs names like pattern 'in{$number}' - required boolean

###### Outputs:

[](#outputs-14)

- out - logical XOR of all inputs
- iout - inverted out

###### Requests:

[](#requests-14)

none

###### Logic:

[](#logic-14)

out = (in1 || in2 || .. || in$n) &amp;&amp; !(in1 &amp;&amp; in2) &amp;&amp; !(in2 &amp;&amp; in3) &amp;&amp; !(in1 &amp;&amp; in3) ..... only one value must be true iout = !out

##### CompareNode

[](#comparenode)

###### Description:

[](#description-16)

Logical XOR node

###### Parametrs:

[](#parametrs-15)

none

###### Grapical:

[](#grapical-15)

```
       ┌───────────────┐
       │               ├─ more
 in1  ─┤               │
       │               │
       │  CompareNode  ├─ less
       │               │
 in2  ─┤               │
       │               ├─ equal
       └───────────────┘

```

###### Inputs:

[](#inputs-15)

- in1 - required some compared value
- in2 - required some compared value

###### Outputs:

[](#outputs-15)

- more - true when in1 &gt; in2
- less - true when in1 &lt; in2
- equal - true when in1 == in2

###### Requests:

[](#requests-15)

none

###### Logic:

[](#logic-15)

more = in1 &gt; in2 less = in1 &lt; in2 equal = in1 == in2

#### Arithmetical nodes

[](#arithmetical-nodes)

##### DivideNode

[](#dividenode)

###### Description:

[](#description-17)

Ariphmetic devide node

###### Parametrs:

[](#parametrs-16)

none

###### Grapical:

[](#grapical-16)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │   DivideNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-16)

- some inputs names like pattern 'in{$number}' - required number

###### Outputs:

[](#outputs-16)

- out - divide in1 to all in$n inputs

###### Requests:

[](#requests-16)

none

###### Logic:

[](#logic-16)

out = in1 / in2 / .. / in$n

##### ModNode

[](#modnode)

###### Description:

[](#description-18)

Ariphmetic mod node

###### Parametrs:

[](#parametrs-17)

none

###### Grapical:

[](#grapical-17)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │    ModNode    ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-17)

- some inputs names like pattern 'in{$number}' - required number

###### Outputs:

[](#outputs-17)

- out - mod of divide in1 to all in$n inputs

###### Requests:

[](#requests-17)

none

###### Logic:

[](#logic-17)

out = in1 % in2 % .. % in$n

##### MultiptyNode

[](#multiptynode)

###### Description:

[](#description-19)

Ariphmetic multiply node

###### Parametrs:

[](#parametrs-18)

none

###### Grapical:

[](#grapical-18)

```
       ┌──────────────┐
 in1  ─┤              │
       │              │
 in2  ─┤              │
       │ MultiplyNode ├─ out
 ...  ─┤              │
       │              │
 in$n ─┤              │
       └──────────────┘

```

###### Inputs:

[](#inputs-18)

- some inputs names like pattern 'in{$number}' - required number

###### Outputs:

[](#outputs-18)

- out - multiply all in$n inputs

###### Requests:

[](#requests-18)

none

###### Logic:

[](#logic-18)

out = in1 \* in2 \* .. \* in$n

##### SubstractNode

[](#substractnode)

###### Description:

[](#description-20)

Ariphmetic substract node

###### Parametrs:

[](#parametrs-19)

none

###### Grapical:

[](#grapical-19)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │ SubstractNode ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-19)

- some inputs names like pattern 'in{$number}' - required number

###### Outputs:

[](#outputs-19)

- out - substract in1 and all in$n inputs

###### Requests:

[](#requests-19)

none

###### Logic:

[](#logic-19)

out = in1 - in2 - .. - in$n

##### SumNode

[](#sumnode)

###### Description:

[](#description-21)

Ariphmetic sum node

###### Parametrs:

[](#parametrs-20)

none

###### Grapical:

[](#grapical-20)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │    SumNode    ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-20)

- some inputs names like pattern 'in{$number}' - required number

###### Outputs:

[](#outputs-20)

- out - sum of all inputs

###### Requests:

[](#requests-20)

none

###### Logic:

[](#logic-20)

out = in1 + in2 + .. + in$n

#### String nodes

[](#string-nodes)

##### ConcatNode

[](#concatnode)

###### Description:

[](#description-22)

String concatination node

###### Parametrs:

[](#parametrs-21)

none

###### Grapical:

[](#grapical-21)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │   ConcatNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-21)

- some inputs names like pattern 'in{$number}' - required string

###### Outputs:

[](#outputs-21)

- out - concatination of all inputs

###### Requests:

[](#requests-21)

none

###### Logic:

[](#logic-21)

'out' = in1 . in2 . ... . in$n

##### MatchNode

[](#matchnode)

###### Description:

[](#description-23)

String match node

###### Parametrs:

[](#parametrs-22)

$pattern - regexp string for matching

###### Grapical:

[](#grapical-22)

```
      ┌───────────────┐
      │               ├─ out
 in  ─┤   MatchNode   │
      │               ├─ iout
      └───────────────┘

```

###### Inputs:

[](#inputs-22)

- in - required string

###### Outputs:

[](#outputs-22)

- out - true if match success
- iout - inverted out

###### Requests:

[](#requests-22)

none

###### Logic:

[](#logic-22)

Emit 'out' if 'in' match pattern Emit 'iout' if 'in' don't match pattern

##### ReplaceNode

[](#replacenode)

###### Description:

[](#description-24)

Replace string or string part

###### Parametrs:

[](#parametrs-23)

$pattern - regexp string for matching $replacement - string for replace

###### Grapical:

[](#grapical-23)

```
      ┌───────────────┐
      │               │
 in  ─┤  ReplaceNode  ├─ out
      │               │
      └───────────────┘

```

###### Inputs:

[](#inputs-23)

- in - required string

###### Outputs:

[](#outputs-23)

- out - result string

###### Requests:

[](#requests-23)

none

###### Logic:

[](#logic-23)

equal preg\_replace($pattern, $replacement, 'in');

#### Array nodes

[](#array-nodes)

##### CollectNode

[](#collectnode)

###### Description:

[](#description-25)

Collect input signals to array

###### Parametrs:

[](#parametrs-24)

none

###### Grapical:

[](#grapical-24)

```
       ┌───────────────┐
 in   ─┤               │
       │  CollectNode  ├─ out
 emit ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-24)

- in - required mixed
- emit - required true

###### Outputs:

[](#outputs-24)

- out - array of input values

###### Requests:

[](#requests-24)

none

###### Logic:

[](#logic-24)

Collect all 'in' signals to array emit this array when 'emit' received

##### CombineNode

[](#combinenode)

###### Description:

[](#description-26)

Collect all inputs to single array

###### Parametrs:

[](#parametrs-25)

none

###### Grapical:

[](#grapical-25)

```
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │  CombineNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘

```

###### Inputs:

[](#inputs-25)

- some inputs names like pattern 'in{$number}' - required mixed

###### Outputs:

[](#outputs-25)

- out - array of inputs values

###### Requests:

[](#requests-25)

none

###### Logic:

[](#logic-25)

Combine all inputs to array like \['in1' =&gt; $valueOfIn1, 'in2' =&gt; $valueOfIn2 , .....\]

##### CountNode

[](#countnode)

###### Description:

[](#description-27)

Collect input signals to array

###### Parametrs:

[](#parametrs-26)

none

###### Grapical:

[](#grapical-26)

```
        ┌───────────────┐
        │               │
 array ─┤   CountNode   ├─ out
        │               │
        └───────────────┘

```

###### Inputs:

[](#inputs-26)

- array - required array

###### Outputs:

[](#outputs-26)

- out - count of array values

###### Requests:

[](#requests-26)

none

###### Logic:

[](#logic-26)

emit count of 'array' elements

##### EachNode

[](#eachnode)

###### Description:

[](#description-28)

Emit output for each element of input array

###### Parametrs:

[](#parametrs-27)

none

###### Grapical:

[](#grapical-27)

```
        ┌──────────────┐
        │              ├─ out
        │              │
 array ─┤   EachNode   ├─ key
        │              │
        │              ├─ complete
        └──────────────┘

```

###### Inputs:

[](#inputs-27)

- array - required array

###### Outputs:

[](#outputs-27)

- out - single value of 'array'
- key - single key of 'arra'
- complete - true when array end

###### Requests:

[](#requests-27)

none

###### Logic:

[](#logic-27)

Emit 'out' and 'key' for each 'array' elements Emit 'complete' when array is end

##### ExtractNode

[](#extractnode)

###### Description:

[](#description-29)

Exctract single value from array by key

###### Parametrs:

[](#parametrs-28)

$key - key

###### Grapical:

[](#grapical-28)

```
        ┌───────────────┐
        │               │
 array ─┤  ExtractNode  ├─ out
        │               │
        └───────────────┘

```

###### Inputs:

[](#inputs-28)

- array - required array

###### Outputs:

[](#outputs-28)

- out - emit single value of array

###### Requests:

[](#requests-28)

none

###### Logic:

[](#logic-28)

Emit array\[$key\]

#### Other nodes

[](#other-nodes)

##### CounterNode

[](#counternode)

###### Description:

[](#description-30)

Calculate count of input signals

###### Parametrs:

[](#parametrs-29)

none

###### Grapical:

[](#grapical-29)

```
      ┌───────────────┐
      │               │
 in  ─┤  CounterNode  ├─ out
      │               │
      └───────────────┘

```

###### Inputs:

[](#inputs-29)

- in - required mixed

###### Outputs:

[](#outputs-29)

- out - emit count of input signals

###### Requests:

[](#requests-29)

none

###### Logic:

[](#logic-29)

calculate input signal count emit 'out' everytime when 'in' received

##### DumpNode

[](#dumpnode)

###### Description:

[](#description-31)

Dump input values

###### Parametrs:

[](#parametrs-30)

none

###### Grapical:

[](#grapical-30)

```
      ┌───────────────┐
      │               │
 in  ─┤    DumpNode   ├─ out
      │               │
      └───────────────┘

```

###### Inputs:

[](#inputs-30)

- in - required mixed

###### Outputs:

[](#outputs-30)

- out - equal 'in'

###### Requests:

[](#requests-30)

none

###### Logic:

[](#logic-30)

forward input to output call dump('in') if dump function available call var\_export if running in cli mode call var\_dump if running in fpm mode

##### RandNode

[](#randnode)

###### Description:

[](#description-32)

Random value emiter

###### Parametrs:

[](#parametrs-31)

$min - min value of random $max - max value of random

###### Grapical:

[](#grapical-31)

```
       ┌───────────────┐
       │               │
 emit ─┤    RandNode   ├─ out
       │               │
       └───────────────┘

```

###### Inputs:

[](#inputs-31)

- emit - required mixed

###### Outputs:

[](#outputs-31)

- out - random number value

###### Requests:

[](#requests-31)

none

###### Logic:

[](#logic-31)

when 'emit' received emit random($min=0, $max=1) value to 'out'

##### RangeNode

[](#rangenode)

###### Description:

[](#description-33)

Range generator

###### Parametrs:

[](#parametrs-32)

$start - start valut of range $end - end value of range $step - step of range

###### Grapical:

[](#grapical-32)

```
       ┌───────────────┐
       │               │
 emit ─┤    RageNode   ├─ out
       │               │
       └───────────────┘

```

###### Inputs:

[](#inputs-32)

- emit - required mixed

###### Outputs:

[](#outputs-32)

- out - array

###### Requests:

[](#requests-32)

none

###### Logic:

[](#logic-32)

equal range($start, $end, $step=1) emit array when 'emit' received

##### ValueNode

[](#valuenode)

###### Description:

[](#description-34)

value emiter

###### Parametrs:

[](#parametrs-33)

$value - emitted value

###### Grapical:

[](#grapical-33)

```
       ┌───────────────┐
       │               │
 emit ─┤   ValueNode   ├─ out
       │               │
       └───────────────┘

```

###### Inputs:

[](#inputs-33)

- emit - required mixed

###### Outputs:

[](#outputs-33)

- out - value

###### Requests:

[](#requests-33)

none

###### Logic:

[](#logic-33)

emit value when 'out' received

### Creating user node

[](#creating-user-node)

To create user node type, create a class extended from NodeAbstract and define public eval() method

#### Input/output defenition

[](#inputoutput-defenition)

Input and output policy declarated in static propery $scheme

```
static propery $scheme = [
    'input' => [                //input declaration
        'optionalInput' => [       //optional input named as 'optionalInput'
        ],
        'requiredInput' => [       //required input named as 'requiredInput'
            'required' => true,    //set 'required' => true to make input required
        ]
    ],
    'user_input' => [           //dynamic input declarated
        'pattern' => '~in\d+~', //pattern for available input names
        'property' => [
            'required' => true  //also can be required
        ]
    ],
    'output' => [                       //output declaration
        'outputWithDefaultData' => [    //output named as 'outputWithDefaultData'
            'data' => 'default data'        //define 'data' property to define default data
        ],
        'outputWithoutDefaultData' => [ //output named as 'outputWithoutDefaultData'
        ]
    ],
    'user_output' => [  //dynamic output declarated
    ],                  //if pattern property is null, all names available
]
```

Output emited only when all required input received

#### Read input/output, emit signals

[](#read-inputoutput-emit-signals)

You can get access to input and output as

```
$value = $this->input['inputName']['data']; //get value from 'inputName' input
$this->output['outputName']['data'] = $value; //set value to 'outputName' output (not emitted)
```

To emit output print:

```
$this->emit('outputName');
//or you can set value and output:
$this->emit('ouputName', $sumeValue);
```

#### Request/response processing

[](#requestresponse-processing)

You can emit request from node:

```
$this->sendRequest($data, $id=null); //if $id == null $id get automaticaly uniq identifier
```

To process response in node extend setResponse method

```
public function setResponse($id, $data)
{
    ....do somethind
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2302d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac2ab44421653cebc795140356530287c37ba8c2011790683db6d2b316ea0e8d?d=identicon)[skrip42](/maintainers/skrip42)

---

Top Contributors

[![Skrip42](https://avatars.githubusercontent.com/u/11675343?v=4)](https://github.com/Skrip42 "Skrip42 (11 commits)")

### Embed Badge

![Health badge](/badges/skrip42-node-processor/health.svg)

```
[![Health](https://phpackages.com/badges/skrip42-node-processor/health.svg)](https://phpackages.com/packages/skrip42-node-processor)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
