PHPackages                             tomzx/dataflow - 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. tomzx/dataflow

AbandonedArchivedLibrary

tomzx/dataflow
==============

A dataflow processor library

25[2 issues](https://github.com/tomzx/dataflow/issues)PHP

Since Jan 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/tomzx/dataflow)[ Packagist](https://packagist.org/packages/tomzx/dataflow)[ RSS](/packages/tomzx-dataflow/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Dataflow
========

[](#dataflow)

[![License](https://camo.githubusercontent.com/3d1182beeaf4ed1e25366a7e8af478f75c74fbb0fd3f73d8a8ffcd91775c6bca/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f64617461666c6f772f6c6963656e73652e737667)](https://packagist.org/packages/tomzx/dataflow)[![Latest Stable Version](https://camo.githubusercontent.com/dffc38c7614b5cad200c89d2ffbe609b8351b87ebfc9acd88c56212ae6740ba0/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f64617461666c6f772f762f737461626c652e737667)](https://packagist.org/packages/tomzx/dataflow)[![Latest Unstable Version](https://camo.githubusercontent.com/1ceedcc8cdd5ee65aa909e9070169d9217e8486535b91d690158ce953a1e0510/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f64617461666c6f772f762f756e737461626c652e737667)](https://packagist.org/packages/tomzx/dataflow)[![Build Status](https://camo.githubusercontent.com/ee7c088c755be3c46e5733851796cd169b7b114d49444a086e8ecf1fcd4a8dfc/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d7a782f64617461666c6f772e737667)](https://travis-ci.org/tomzx/dataflow)[![Code Quality](https://camo.githubusercontent.com/5bcfd80e5a9969c24bb125c621323e1f8fb8c4d219fe96312f9777e21c97ed56/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f6d7a782f64617461666c6f772e737667)](https://scrutinizer-ci.com/g/tomzx/dataflow/code-structure)[![Code Coverage](https://camo.githubusercontent.com/3b574ea2223fd7c175491b14c57dfb46afa1d50f524dd716abee8bfb57b02a9e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f6d7a782f64617461666c6f772e737667)](https://scrutinizer-ci.com/g/tomzx/dataflow)[![Total Downloads](https://camo.githubusercontent.com/c77e273651b36ae1b8acc71c751a4011153b80c1e24dfc669bf97264f3ab240c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d7a782f64617461666c6f772e737667)](https://packagist.org/packages/tomzx/dataflow)

Create simple pipelines as well as complex graphs which may be used to process data or compute only when a stage's dependencies are resolved.

Getting started
---------------

[](#getting-started)

### A simple pipeline (sequential)

[](#a-simple-pipeline-sequential)

```
$a = function($payload) {
	return $payload * -1;
};

$b = function($payload) {
	return $payload * 10000;
};

$pipeline = (new Pipeline)
	->pipe($a)
	->pipe($b);

// Returns 100000
$pipeline->process(-10);

// Can also be built as the following

$stages = [
	1 => [$a],
	2 => [$b, 1],
];

$pipeline = new Pipeline($stages);

```

### A graph flow

[](#a-graph-flow)

```
$p1 = function($payload) {
	return $payload . '1';
};

$p2 = function($payloadP1) {
	return $payloadP1 . '2';
};

$p3 = function($payloadP1) {
	return $payloadP1 . '3';
};

$p4 = function($payloadP1) {
	return $payloadP1 . '4';
};

$p5 = function($payloadP2, $payloadP3) {
	return $payloadP2 . ' ' . $payloadP3 . '5';
};

$p6 = function($payloadP5) {
	return $payloadP5 . '6';
};

$stages = [
	1 => [$p1],
	2 => [$p2, 1],
	3 => [$p3, 1],
	4 => [$p4, 1],
	5 => [$p5, 2, 3],
	6 => [$p6, 5],
];

$pipeline = new Pipeline($stages);

// Returns Test 12 Test 1356
$pipeline->process('Test ');

// May also be built using the Graph class

$graph = new Graph($stages, new Sequential);
// or $graph = new Graph($stages, new Parallel);

$results = $graph->process('Test ');

// You may inspect the output of every node
// Returns Test 1
$result->output(1);
// Returns Test 12
$result->output(2);
// Returns Test 13
$result->output(3);
// Returns Test 14
$result->output(4);
// Returns Test 12 Test 135
$result->output(5);
// Returns Test 12 Test 1356
$result->output(6);

```

Processors
----------

[](#processors)

In order to process your graph, you are provided with two processors: a `Sequential` processor and a `Parallel` processor.

The `Sequential` processor takes a graph and turns it into a sequence of operations to accomplish. It basically will compute the graph dependencies and ensure that those dependencies are resolved by the time each stage is to be executed. With the `Sequential` processor, only a single task may be executed at a time.

The `Parallel` processor is useful when many tasks can be executed in parallel. Similar to the `Sequential` processor, it will validate that the given graph can be resolved. Then, it will execute all the tasks that can be executed in parallel at the same time. On a multi-core processor, it is expected that the `Parallel` processor will complete faster if it is given parallelizable tasks.

License
-------

[](#license)

The code is licensed under the [MIT license](http://choosealicense.com/licenses/mit/). See [LICENSE](LICENSE).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/218f6db237e6937c05550d4d6df648f50cd9b26b098fc8c1be3930fe7d5c71e9?d=identicon)[tomzx](/maintainers/tomzx)

---

Top Contributors

[![tomzx](https://avatars.githubusercontent.com/u/188960?v=4)](https://github.com/tomzx "tomzx (7 commits)")

### Embed Badge

![Health badge](/badges/tomzx-dataflow/health.svg)

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

PHPackages © 2026

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