haruncpi/fluent-pipe

Enables fluent value transformation via chained callbacks

Maintainers

Package info

github.com/haruncpi/fluent-pipe

pkg:composer/haruncpi/fluent-pipe

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.1 2025-07-17 09:23 UTC

This package is not auto-updated.

Last update: 2026-03-01 17:34:18 UTC


README

Enables fluent value transformation via chained callbacks

Installation

composer require haruncpi/fluent-pipe

Usage

use Haruncpi\FluentPipe\FluentPipe;

$text = FluentPipe::from(' hello fluent pipe!')
    ->then(fn($text) => trim($text))
    ->then(fn($text) => explode(' ', $text))
    ->then(fn($text) => array_map(fn($word) => ucfirst($word), $text))
    ->then(fn($array) => implode(' ', $array))
    ->get();

echo $text; // Hello Fluent Pipe!

Or

use Haruncpi\FluentPipe\FluentPipe;

$text = FluentPipe::from(' hello fluent pipe!')
    ->through([
        fn($text) => trim($text),
        fn($text) => explode(' ', $text),
        fn($text) => array_map(fn($word) => ucfirst($word), $text),
        fn($array) => implode(' ', $array),
    ])
    ->get();

var_dump($text); // Hello Fluent Pipe!

License

CC BY 4.0