PHPackages                             kariricode/processor-pipeline - 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. [Framework](/categories/framework)
4. /
5. kariricode/processor-pipeline

ActiveLibrary[Framework](/categories/framework)

kariricode/processor-pipeline
=============================

A robust, immutable processor pipeline component for the KaririCode Framework — ARFA 1.3 compliant. Enables modular, configurable processing chains for data transformation, validation, and sanitization.

v2.0.0(2mo ago)07682MITPHPPHP ^8.4CI passing

Since Oct 13Pushed 2mo agoCompare

[ Source](https://github.com/KaririCode-Framework/kariricode-processor-pipeline)[ Packagist](https://packagist.org/packages/kariricode/processor-pipeline)[ Docs](https://kariricode.org)[ RSS](/packages/kariricode-processor-pipeline/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (2)

KaririCode ProcessorPipeline
============================

[](#kariricode-processorpipeline)

[![PHP 8.4+](https://camo.githubusercontent.com/270717987f5341772d79b57567226e54ed27b2d4199bbdc98a96e2edf24902fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/1e64768fef09f35b66921728160f533208fd2e3e792a2755187d16c25d535511/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d3232633535652e737667)](LICENSE)[![PHPStan Level 9](https://camo.githubusercontent.com/a812723b363d3726b682e5d739e91f2ade163846054ce3797b9085b84cc61806/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d344634364535)](https://phpstan.org/)[![Tests](https://camo.githubusercontent.com/57721185259ee7248b98fc70768fad7b80589713d412b13bc7c7a9381e16f435/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d31323825323070617373696e672d323263353565)](https://kariricode.org)[![ARFA](https://camo.githubusercontent.com/708efab30524ab8fd4e0413edfb4378bb863a71559c4a9b59cdcb7b0ab6f65c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f415246412d312e332d6f72616e6765)](https://kariricode.org)[![KaririCode Framework](https://camo.githubusercontent.com/bd3e3709bf161ac982b76f7afd06c39afe478d15f2b5e1d47df8606b5c9c03f0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4b6172697269436f64652d4672616d65776f726b2d6f72616e6765)](https://kariricode.org)

**Immutable, composable processor pipelines for the KaririCode Framework —
context-based registry, flexible spec format, structured error collection, PHP 8.4+.**

[Installation](#installation) · [Quick Start](#quick-start) · [Features](#features) · [Pipeline](#the-pipeline) · [Architecture](#architecture)

---

The Problem
-----------

[](#the-problem)

Building reusable data-processing chains in PHP typically means either rigid class hierarchies or ad-hoc chains of function calls that are hard to test, configure, and compose:

```
// The old way: ad-hoc chain, hard to test or reuse
function processInput(string $input): string
{
    $input = trim($input);
    $input = strtolower($input);
    if (strlen($input) < 3) {
        throw new \InvalidArgumentException('Too short');
    }
    return $input;
}
```

No registry, no configuration per processor, no error collection, no immutability — just imperative code you copy-paste everywhere.

The Solution
------------

[](#the-solution)

```
use KaririCode\ProcessorPipeline\ProcessorRegistry;
use KaririCode\ProcessorPipeline\ProcessorBuilder;

// 1. Register processors once, per context
$registry = new ProcessorRegistry();
$registry
    ->register('sanitizer', 'trim',      new TrimProcessor())
    ->register('sanitizer', 'lowercase', new LowercaseProcessor())
    ->register('validator', 'length',    new LengthValidator());

// 2. Build immutable pipelines from specs
$builder   = new ProcessorBuilder($registry);
$sanitized = $builder->buildPipeline('sanitizer', ['trim', 'lowercase']);
$validated = $builder->buildPipeline('validator', [
    'length' => ['minLength' => 3, 'maxLength' => 50],
]);

// 3. Execute — pipelines are immutable and reusable
$output = $sanitized->process('  HELLO WORLD  '); // 'hello world'
$validated->process($output);
```

---

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

[](#requirements)

RequirementVersionPHP8.4 or higherkariricode/contract^2.8kariricode/exception^1.2---

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

[](#installation)

```
composer require kariricode/processor-pipeline
```

---

Quick Start
-----------

[](#quick-start)

Define processors, register them, build a pipeline, execute:

```
