Flowbased programming protocol (fbp) config file loader
This library allows you to load and parse configuration for your phpflo project. It also works standalone if you want to convert your old json configs to fbp spec. Supported config formats are json (.json), yaml (.yml) and fbp (.fbp), output is an object of type FbpDefinition. This allows you to output your parsed content in different formats, ranging from array over fbp, json to yaml.
Basic usage:
// load fbp config
$defintiion = \PhpFlo\Loader\Loader::load('my/fbp/config/file.fbp');
You can load json, yml and fbp that way.
Parser by itself:
$myFbpConfig = <<<EOF
'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);
Dump your flow to a format:
$json = \PhpFlo\Fbp\FbpDumper::toJson($definition);
$yaml = \PhpFlo\Fbp\FbpDumper::toYaml($definition);
$fbp = \PhpFlo\Fbp\FbpDumper::toFbp($definition);
The definition has following schema:
$schema = [
'properties' => ['name' => '',],
'initializers' => [
[
'data' => '',
'tgt' => [
'process' => '',
'port' => '',
],
],
],
'processes' => [
'ReadFile' => [
'component' => '',
'metadata' => [
'label' => '',
],
],
],
'connections' => [
[
'src' => [
'process' => '',
'port' => '',
],
'tgt' => [
'process' => '',
'port' => '',
],
],
],
]
Regular install via composer:
composer require phpflo/phpflo-fbp