PHPackages                             fab2s/nodalflow - 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. fab2s/nodalflow

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

fab2s/nodalflow
===============

A PHP Nodal WorkFlow

2.1.0(3mo ago)16362.4k↓23.5%31MITPHPPHP ^8.0CI passing

Since Apr 21Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/fab2s/NodalFlow)[ Packagist](https://packagist.org/packages/fab2s/nodalflow)[ RSS](/packages/fab2s-nodalflow/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (21)Used By (1)

NodalFlow
=========

[](#nodalflow)

[![Documentation Status](https://camo.githubusercontent.com/c327d571e6994faa07f8b1d05120c78de602d73cab3c0e58d7333a68c3f745cb/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f6e6f64616c666c6f772f62616467652f3f76657273696f6e3d6c6174657374)](http://nodalflow.readthedocs.io/en/latest/?badge=latest) [![CI](https://github.com/fab2s/NodalFlow/actions/workflows/ci.yml/badge.svg)](https://github.com/fab2s/NodalFlow/actions/workflows/ci.yml) [![QA](https://github.com/fab2s/NodalFlow/actions/workflows/qa.yml/badge.svg)](https://github.com/fab2s/NodalFlow/actions/workflows/qa.yml) [![Total Downloads](https://camo.githubusercontent.com/1d68d04b83f46afa88685f95af3b50c9f11cd5a8969f132bcaefde7eb6b4d45c/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f6e6f64616c666c6f772f646f776e6c6f616473)](https://packagist.org/packages/fab2s/nodalflow) [![Monthly Downloads](https://camo.githubusercontent.com/5b6d84bb3fac24ea1d528169cfd4ef5d414a5e1caf55df0c1d7f27263b5605d6/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f6e6f64616c666c6f772f642f6d6f6e74686c79)](https://packagist.org/packages/fab2s/nodalflow) [![Latest Stable Version](https://camo.githubusercontent.com/74a0628578519e85e8c0b9e2f423e6c6f81d24bc87b86be0e1cfe4a3e2e8856d/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f6e6f64616c666c6f772f762f737461626c65)](https://packagist.org/packages/fab2s/nodalflow) [![Code Climate](https://camo.githubusercontent.com/bc99b7dd83cc5f7221745abea2e9fa62b12207b1c512c72f7192e85dd556d080/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f66616232732f4e6f64616c466c6f772f6261646765732f6770612e737667)](https://codeclimate.com/github/fab2s/NodalFlow) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/bf683441ef843fb31ed2e62c5ac1f4ff128593ff150dfa6f7bccb0414115c973/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66616232732f4e6f64616c466c6f772f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/fab2s/NodalFlow/?branch=master) [![PRs Welcome](https://camo.githubusercontent.com/7d9ed3c8f22eceb1711573169b1390cc0b1194467340dc815205060c162b5309/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](http://makeapullrequest.com) [![License](https://camo.githubusercontent.com/d5ad739f3b1338aa277a5d6d7a96e4a812c5788ce15370c1ff3ce00176ff3b55/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f6e6f64616c666c6f772f6c6963656e7365)](https://packagist.org/packages/fab2s/nodalflow)

`NodalFlow` is a generic Workflow that can execute chained tasks. It is designed around simple interfaces that specifies a flow composed of executable Nodes and Flows. Nodes can be executed or traversed. They accept a single parameter as argument and can be set to pass or not their result as an argument for the next node. Flows also accept one argument and may be set to pass their result to be used or not as an argument for their first Node.

```
+--------------------------+Flow Execution+----------------------------->

+-----------------+        +------------------+         +---------------+
|   scalar node   +--------> trarersable node +--------->   next node   +-------->...
+-----------------+        +------------------+         +---------------+
                                              |
                                              |         +---------------+
                                              +--------->   next node   +-------->...
                                              |         +---------------+
                                              |
                                              |         +---------------+
                                              +--------->   next node   +-------->...
                                              |         +---------------+
                                              |
                                              +--------->...

```

Nodes are linked together by the fact they return a value or not. When a node is returning a value (by declaration), it will be used as argument to the next node (but not necessarily used by it). When it doesn't, the current parameter (if any) will be used as argument by the next node, and so on until one node returns a result intended to be used as argument to the next node.

```
+--------+ Result 1 +--------+ Result 3
| Node 1 +----+-----> Node 3 +--------->...
+--------+    |     +--------+
              |
              |
         +----v---+
         | Node 2 |
         +--------+

```

In this flow, as node 2 (which may as well be a whole flow or branch) is not returning a value, it is executed "outside" of the main execution line.

In other words, `NodalFlow` implements a directed graph structure in the form of a tree composed of nodes that can be, but not always are, branches or leaves.

`NodalFlow` also goes beyond that by allowing any Flow or Node to send whatever parameter to any part of any Flow alive within the same PHP process. The feature shares similarities with the `Generator`'s [`sendTo()`](/docs/usage.md#the-sendto-methods) method and makes it possible to turn Flows into *executable networks* of Nodes (and Flows).

```
+-------------------------+-------+----------+
|               |-->      |       |          |
+-+Node1+->tNode|-->Node3+> bNode +-->NodeN+->
|FlowA       ^  |-->      |   |   |          |
+------------|----------------|--------------+
             |            |   v   |
             |            | Node1 |
             |            |   |   |
             |            |   v   |
             +---sendTo()-+ Node2 |
                          | +-+-+ |
                          | | | | |
                          | v v v |
                          | Node3 |
                          +---|--------------+
                          |   v   |          |
                          | bNode +-->Node1+->
                          |   |   |     |    |
                          +---|--------------+
                          |   |   |     |
                          +---v---+     |
                                        |
               +-------sendTo()---------+
               |
 +-------------|----------------+
 |             v                |
 +--Node1-->Node2-->NodeN--...+->
 |  FlowB                       |
 +------------------------------+

```

`NodalFlow` aims at organizing and simplifying data processing workflow's where arbitrary amount of data may come from various generators, pass through several data processors and / or end up in various places and formats. But it can as well be the foundation to organizing pretty much any sequence of tasks (`NodalFlow` could easily become Turing complete after all). It makes it possible to dynamically configure and execute complex scenario in an organized and repeatable manner (`NodalFlow` is [serializable](/docs/serialization.md)). And even more important, to write Nodes that will be reusable in any other workflow you may think of.

`NodalFlow` enforces minimalistic requirements upon nodes. This means that in most cases, you should extend `NodalFlow` to implement the required constraints and grammar for your use case.

[YaEtl](https://github.com/fab2s/YaEtl) is an example of a more specified workflow build upon [NodalFlow](https://github.com/fab2s/NodalFlow).

`NodalFlow` shares conceptual similarities with [Transducers](https://clojure.org/reference/transducers) (if you are interested, also have a look at [Transducers PHP](https://github.com/mtdowling/transducers.php)) as it allow basic interaction chaining, especially when dealing with `ExecNodes`, but the comparison diverges quickly.

NodalFlow Documentation
-----------------------

[](#nodalflow-documentation)

[![Documentation Status](https://camo.githubusercontent.com/c327d571e6994faa07f8b1d05120c78de602d73cab3c0e58d7333a68c3f745cb/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f6e6f64616c666c6f772f62616467652f3f76657273696f6e3d6c6174657374)](http://nodalflow.readthedocs.io/en/latest/?badge=latest) Documentation can be found at [ReadTheDocs](http://nodalflow.readthedocs.io/en/latest/?badge=latest)

Installation
------------

[](#installation)

`NodalFlow` can be installed using composer:

```
composer require "fab2s/nodalflow"

```

If you want to specifically install the php &gt;=7.2.0 version, use:

```
composer require "fab2s/nodalflow" ^2.0.0

```

If you want to specifically install the php 5.6/7.1 version, use:

```
composer require "fab2s/nodalflow" ^1

```

Once done, you can start playing:

```
$nodalFlow = new NodalFlow;
$result = $nodalFlow->addPayload(('SomeClass::someTraversableMethod', true, true))
    ->addPayload('intval', true)
    // or ->add(new CallableNode('intval', false))
    // or ->add(new PayloadNodeFactory('intval', false))
    ->addPayload(function($param) {
        return $param + 1;
    }, true)
    ->addPayload(function($param) {
        for($i = 1; $i < 1024; $i++) {
            yield $param + $i;
        }
    }, true, true)
    ->addPayload($anotherNodalFlow, false)
    // or ->add(new BranchNode($anotherNodalFlow, false))
    // or ->add(new PayloadNodeFactory($anotherNodalFlow, false))
    ->addPayload([$someObject, 'someMethod'], false)
    ->exec($wateverParam);
```

Requirements
------------

[](#requirements)

`NodalFlow` is tested against php 8.0, 8.1, 8.2, 8.3 and 8.4

Contributing
------------

[](#contributing)

Contributions are welcome, do not hesitate to open issues and submit pull requests.

License
-------

[](#license)

`NodalFlow` is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance78

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity77

Established project with proven stability

 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

Every ~188 days

Recently: every ~308 days

Total

18

Last Release

115d ago

Major Versions

1.x-dev → 2.0.02020-10-18

PHP version history (5 changes)v1.0.0-rc.1PHP &gt;=5.6.0

2.0.0PHP ~7.1

2.0.1PHP ^7.1|^8.0

2.0.2PHP ^7.2|^8.0

2.1.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7323989?v=4)[fab2s](/maintainers/fab2s)[@fab2s](https://github.com/fab2s)

---

Top Contributors

[![fab2s](https://avatars.githubusercontent.com/u/7323989?v=4)](https://github.com/fab2s "fab2s (227 commits)")

---

Tags

data-processingflowflow-executioninterruptionnetwork-flownodalnode-networkphptraversable-nodesworkflowphpexecutableserializableworkflownetworknodegraphdata processingtraversableNodalNodalFlow

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fab2s-nodalflow/health.svg)

```
[![Health](https://phpackages.com/badges/fab2s-nodalflow/health.svg)](https://phpackages.com/packages/fab2s-nodalflow)
```

###  Alternatives

[fab2s/yaetl

Widely Extended Nodal Extract-Transform-Load ETL Workflow AKA NEJQTL or Nodal-Extract-Join-Qualify-Tranform-Load

64181.0k](/packages/fab2s-yaetl)[phonetworks/pho-lib-graph

A general purpose graph library in PHP

556.0k1](/packages/phonetworks-pho-lib-graph)[sdboyer/gliph

A graph library for PHP.

17029.1k1](/packages/sdboyer-gliph)[zoon/rialto

Manage Node resources from PHP

12199.4k3](/packages/zoon-rialto)[halfpastfouram/phpchartjs

PHP library for ChartJS

2512.2k](/packages/halfpastfouram-phpchartjs)[godbout/alfred-workflow-scriptfilter

Generate Alfred 3 or 4 Workflow Results in PHP with a laugh.

173.7k1](/packages/godbout-alfred-workflow-scriptfilter)

PHPackages © 2026

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