haruncpi / fluent-pipe
Enables fluent value transformation via chained callbacks
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/haruncpi/fluent-pipe
Requires
- php: >=5.6.0
This package is not auto-updated.
Last update: 2025-10-12 15:36:42 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