Download the PHP package skrip42/node-processor without Composer

On this page you can find all versions of the php package skrip42/node-processor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package node-processor

NodeProcessor

Description

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

Installing

composer require skrip42/node-processor

Documentation

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

Add

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

Create process

This section is presented to understand the processes, the recommended way to create processes is process builder.

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

Running process and debug

For start process:

You will get array of the form:

status is number indicating the current state of the process

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

requests is array of request (see Request/Response)

$process->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

You can serialize and deserialize process as default php tools:

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

Process builder

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

using the builder you can also parameterize your process:

Request/Response

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:

You can send an answer like:

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

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:

ComonNodes

Manager nodes

BeginNode
Description:

Start node, executed when the process starts

Parametrs:
EndNode
Description:

End node, collect result of process

Parametrs:

none

Grapical:
      ┌───────────────┐
in1  ─┤               │
      │               │
in2  ─┤               │
      │    EndNode    │
...  ─┤               │
      │               │
in$n ─┤               │
      └───────────────┘
Inputs:
SplitterNode
Description:

Forked process trates

Parametrs:

none

Grapical:
     ┌───────────────┐
     │               ├─ out1
     │               │
     │               ├─ out2
in  ─┤  SplitterNode │
     │               ├─ ...
     │               │
     │               ├─ out$n
     └───────────────┘
Inputs:
SingleNode
Description:

singlify input signals

Parametrs:

none

Grapical:
       ┌───────────────┐
in    ─┤               │
       │   SingleNode  ├─ out
reset ─┤               │
       └───────────────┘
Inputs:
WaitingNode
Description:

Waiting emit signal for continue

Parametrs:

none

Grapical:
      ┌───────────────┐
in   ─┤               │
      │  WaitingNode  ├─ out
emit ─┤               │
      └───────────────┘
Inputs:
TriggerNode
Description:

emit additional signals when input signal received

Parametrs:

none

Grapical:
      ┌───────────────┐
      │               ├─ before
      │               │
in   ─┤  TriggerNode  ├─ out
      │               │
      │               ├─ after
      └───────────────┘
Inputs:
IterateNode
Description:

iterate array for each 'emit' signal received

Parametrs:

none

Grapical:
        ┌───────────────┐
array  ─┤               ├─ out
        │               │
emit   ─┤  IterateNode  ├─ complete
        │               │
reset  ─┤               ├─ count
        └───────────────┘
Inputs:
PauseNode
Description:

Stop current thread until a response is received

Parametrs:

none

Grapical:
      ┌───────────────┐
      │               │
 in  ─┤   PauseNode   ├─ out
      │               │
      └───────────────┘
Inputs:
RepeatNode
Description:

Repeat 'in' sume time

Parametrs:

$value - count of repeat time

Grapical:
      ┌───────────────┐
      │               ├─ out
 in  ─┤   RepeatNode  │
      │               ├─ complete
      └───────────────┘
Inputs:
SubprocessNode
Description:

Run subprocess (another instance of Process) inside node

Parametrs:

$subprocessScheme like process builder

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

Depending on the scheme Map inputs to scheme parameters

Outputs:

Depending on the scheme Map subprocess output to node output

Requests:

Forward request from subprocess Forward response to subprocess

Logic:

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
Description:

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

Parametrs:

$subprocessScheme like process builder

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

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

Outputs:

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

Requests:

Forward request from subprocesses Forward response to subprocesses

Logic:

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

AndNode
Description:

Logical AND node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │    AndNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘
Inputs:
NotNode
Description:

Logical NOT node

Parametrs:

none

Grapical:
      ┌───────────────┐
      │               │
 in  ─┤   CountNode   ├─ out
      │               │
      └───────────────┘
Inputs:
OrNode
Description:

Logical OR node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │     OrNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘
Inputs:
XorNode
Description:

Logical XOR node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               ├─ out
 in2  ─┤               │
       │    XorNode    │
 ...  ─┤               │
       │               ├─ iout
 in$n ─┤               │
       └───────────────┘
Inputs:
CompareNode
Description:

Logical XOR node

Parametrs:

none

Grapical:
       ┌───────────────┐
       │               ├─ more
 in1  ─┤               │
       │               │
       │  CompareNode  ├─ less
       │               │
 in2  ─┤               │
       │               ├─ equal
       └───────────────┘
Inputs:

Arithmetical nodes

DivideNode
Description:

Ariphmetic devide node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │   DivideNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘
Inputs:
ModNode
Description:

Ariphmetic mod node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │    ModNode    ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘
Inputs:
MultiptyNode
Description:

Ariphmetic multiply node

Parametrs:

none

Grapical:
       ┌──────────────┐
 in1  ─┤              │
       │              │
 in2  ─┤              │
       │ MultiplyNode ├─ out
 ...  ─┤              │
       │              │
 in$n ─┤              │
       └──────────────┘
Inputs:
SubstractNode
Description:

Ariphmetic substract node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │ SubstractNode ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘
Inputs:
SumNode
Description:

Ariphmetic sum node

Parametrs:

none

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

String nodes

ConcatNode
Description:

String concatination node

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │   ConcatNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘
Inputs:
MatchNode
Description:

String match node

Parametrs:

$pattern - regexp string for matching

Grapical:
      ┌───────────────┐
      │               ├─ out
 in  ─┤   MatchNode   │
      │               ├─ iout
      └───────────────┘
Inputs:
ReplaceNode
Description:

Replace string or string part

Parametrs:

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

Grapical:
      ┌───────────────┐
      │               │
 in  ─┤  ReplaceNode  ├─ out
      │               │
      └───────────────┘
Inputs:

Array nodes

CollectNode
Description:

Collect input signals to array

Parametrs:

none

Grapical:
       ┌───────────────┐
 in   ─┤               │
       │  CollectNode  ├─ out
 emit ─┤               │
       └───────────────┘
Inputs:
CombineNode
Description:

Collect all inputs to single array

Parametrs:

none

Grapical:
       ┌───────────────┐
 in1  ─┤               │
       │               │
 in2  ─┤               │
       │  CombineNode  ├─ out
 ...  ─┤               │
       │               │
 in$n ─┤               │
       └───────────────┘
Inputs:
CountNode
Description:

Collect input signals to array

Parametrs:

none

Grapical:
        ┌───────────────┐
        │               │
 array ─┤   CountNode   ├─ out
        │               │
        └───────────────┘
Inputs:
EachNode
Description:

Emit output for each element of input array

Parametrs:

none

Grapical:
        ┌──────────────┐
        │              ├─ out
        │              │
 array ─┤   EachNode   ├─ key
        │              │
        │              ├─ complete
        └──────────────┘
Inputs:
ExtractNode
Description:

Exctract single value from array by key

Parametrs:

$key - key

Grapical:
        ┌───────────────┐
        │               │
 array ─┤  ExtractNode  ├─ out
        │               │
        └───────────────┘
Inputs:

Other nodes

CounterNode
Description:

Calculate count of input signals

Parametrs:

none

Grapical:
      ┌───────────────┐
      │               │
 in  ─┤  CounterNode  ├─ out
      │               │
      └───────────────┘
Inputs:
DumpNode
Description:

Dump input values

Parametrs:

none

Grapical:
      ┌───────────────┐
      │               │
 in  ─┤    DumpNode   ├─ out
      │               │
      └───────────────┘
Inputs:
RandNode
Description:

Random value emiter

Parametrs:

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

Grapical:
       ┌───────────────┐
       │               │
 emit ─┤    RandNode   ├─ out
       │               │
       └───────────────┘
Inputs:
RangeNode
Description:

Range generator

Parametrs:

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

Grapical:
       ┌───────────────┐
       │               │
 emit ─┤    RageNode   ├─ out
       │               │
       └───────────────┘
Inputs:
ValueNode
Description:

value emiter

Parametrs:

$value - emitted value

Grapical:
       ┌───────────────┐
       │               │
 emit ─┤   ValueNode   ├─ out
       │               │
       └───────────────┘
Inputs:

Creating user node

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

Input/output defenition

Input and output policy declarated in static propery $scheme

Output emited only when all required input received

Read input/output, emit signals

You can get access to input and output as

To emit output print:

Request/response processing

You can emit request from node:

To process response in node extend setResponse method


All versions of node-processor with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package skrip42/node-processor contains the following files

Loading the files please wait ....