PHP code example of grazulex / laravel-flowpipe

1. Go to this page and download the library: Download grazulex/laravel-flowpipe 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/ */

    

grazulex / laravel-flowpipe example snippets


use Grazulex\LaravelFlowpipe\Flowpipe;

$result = Flowpipe::make()
    ->send('Hello World')
    ->through([
        fn($data, $next) => $next(strtoupper($data)),
        fn($data, $next) => $next(str_replace(' ', '-', $data)),
        fn($data, $next) => $next($data . '!'),
    ])
    ->thenReturn();

// Result: "HELLO-WORLD!"

use Grazulex\LaravelFlowpipe\Flowpipe;

$result = Flowpipe::fromDefinition('user_registration')
    ->send($userData)
    ->thenReturn();