Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/darkwood-com/flow

💧Flow
https://github.com/darkwood-com/flow

amphp async fiber monad php reactphp spatie swoole symfony

Last synced: 3 months ago
JSON representation

💧Flow

Awesome Lists containing this project

README

        



Flow

## Why ?

Flow concept aims to solve

- Adopt asynchronous as native implementation
- Build your code with functional programming
- Assemble your code visually

## Installation

PHP 8.3 is the minimal version to use Flow
The recommended way to install it through [Composer](http://getcomposer.org) and execute

```bash
composer require darkwood/flow
```

## Usage

```php
new D2($data1->n1 += 1);
yield fn (D2 $data2) => new D3($data2->n2 * 2);
yield function(D3 $data3) {
printf("my number %d\n", $ip->data->n3)); // display 'my number 10'

return new D4($data3->n3);
};
});

$ip = new Ip(new D1(4));
$flow($ip);
$flow->await();
```

## Examples

A working script is available in the bundled `examples` directory

- Run Flow : `php examples/flow.php`
- Run Y-Combinator Flow : `php examples/yflow.php`
- Start Server : `php examples/server.php`
Start Client(s) : `php examples/client.php`

## Documentation

[https://darkwood-com.github.io/flow](https://darkwood-com.github.io/flow)

## License

Flow is released under the MIT License.