Skip to content

[READONLY] subtree split - Flowbased programming protocol (fbp) config file loader, parser and dumper

License

Notifications You must be signed in to change notification settings

phpflo/phpflo-fbp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpflo-fbp: load, parse, dump

Flowbased programming protocol (fbp) config file loader

Build Status Scrutinizer Code Quality Code Coverage License

Introduction

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.

Code Samples

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' => '',
            ],
        ],
    ],
]

Installation

Regular install via composer:

composer require phpflo/phpflo-fbp

About

[READONLY] subtree split - Flowbased programming protocol (fbp) config file loader, parser and dumper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages