PHP code example of haruncpi / fluent-pipe

1. Go to this page and download the library: Download haruncpi/fluent-pipe library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

haruncpi / fluent-pipe example snippets


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!

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!