PHP code example of phpflo / phpflo-fbp

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

    

phpflo / phpflo-fbp example snippets


// load FBP config
$defintiion = PhpFlo\Loader\Loader::load('my/fbp/config/file.fbp');

$myFbpConfig = <<<EOF
# Read a file and cout its lines
'test.file' -> IN ReadFile(ReadFile)
ReadFile(ReadFile) OUT -> IN SplitbyLines(SplitStr)
ReadFile() ERROR -> IN Display(Output)
SplitbyLines() OUT -> IN CountLines(Counter)
CountLines() COUNT -> IN Display()
EOF;

$parser = new PhpFlo\Fbp\FbpParser();
$definition = $parser->run($myFbpConfig);

$json = PhpFlo\Fbp\FbpDumper::toJson($definition);
$yaml = PhpFlo\Fbp\FbpDumper::toYaml($definition);
$fbp = PhpFlo\Fbp\FbpDumper::toFbp($definition);

$schema = [
    'properties' => ['name' => '',],
    'initializers' => [
        [
            'data' => '',
            'tgt' => [
                'process' => '',
                'port' => '',
            ],
        ],
    ],
    'processes' => [
        'ReadFile' => [
            'component' => '',
            'metadata' => [
                'label' => '',
            ],
        ],
    ],
    'connections' => [
        [
            'src' => [
                'process' => '',
                'port' => '',
            ],
            'tgt' => [
                'process' => '',
                'port' => '',
            ],
        ],
    ],
]

composer