Skip to content

Commit 08cf65c

Browse files
author
Marc Aschmann
committed
Add more descriptive README
1 parent 45f87d8 commit 08cf65c

File tree

1 file changed

+79
-3
lines changed

1 file changed

+79
-3
lines changed

README.md

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,85 @@
1-
# phpflo-fbp
2-
fbp implementation for php
1+
# phpflo-fbp: load, parse, dump
2+
Flowbased programming protocol (fbp) config file loader
33

44
[![Build Status](https://travis-ci.org/phpflo/phpflo-fbp.svg?branch=master)](https://travis-ci.org/phpflo)
55
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpflo/phpflo-fbp/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpflo/phpflo-fbp/?branch=master)
66
[![Code Coverage](https://scrutinizer-ci.com/g/phpflo/phpflo-fbp/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpflo/phpflo-fbp/?branch=master)
7+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
78

89

9-
license MIT
10+
## Introduction
11+
12+
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.
13+
Supported config formats are json (.json), yaml (.yml) and fbp (.fbp), output is array.
14+
15+
## Code Samples
16+
17+
Basic usage:
18+
```php
19+
// load fbp config
20+
$defintiion = \PhpFlo\Loader\Loader::load('my/fbp/config/file.fbp');
21+
```
22+
You can load json, yml and fbp that way.
23+
24+
Parser by itself:
25+
```php
26+
$myFbpConfig = <<<EOF
27+
'test.file' -> IN ReadFile(ReadFile)
28+
ReadFile(ReadFile) OUT -> IN SplitbyLines(SplitStr)
29+
ReadFile ERROR -> IN Display(Output)
30+
SplitbyLines OUT -> IN CountLines(Counter)
31+
CountLines COUNT -> IN Display
32+
EOF;
33+
34+
$parser = new \PhpFlo\Fbp\FbpParser();
35+
$definition = $parser->run($myFbpConfig);
36+
```
37+
Dump your flow to a format:
38+
```php
39+
$json = \PhpFlo\Fbp\FbpDumper::toJson($definition);
40+
$yaml = \PhpFlo\Fbp\FbpDumper::toYaml($definition);
41+
$fbp = \PhpFlo\Fbp\FbpDumper::toFbp($definition);
42+
```
43+
44+
The definition has following schema:
45+
```php
46+
$schema = [
47+
'properties' => ['name' => '',],
48+
'initializers' => [
49+
[
50+
'data' => '',
51+
'tgt' => [
52+
'process' => '',
53+
'port' => '',
54+
],
55+
],
56+
],
57+
'processes' => [
58+
'ReadFile' => [
59+
'component' => '',
60+
'metadata' => [
61+
'label' => '',
62+
],
63+
],
64+
],
65+
'connections' => [
66+
[
67+
'src' => [
68+
'process' => '',
69+
'port' => '',
70+
],
71+
'tgt' => [
72+
'process' => '',
73+
'port' => '',
74+
],
75+
],
76+
],
77+
]
78+
```
79+
80+
## Installation
81+
82+
Regular install via composer:
83+
```php
84+
composer require phpflo/phpflo-fbp
85+
```

0 commit comments

Comments
 (0)