Skip to content

Commit

Permalink
Merge pull request #52 from darkwood-com/1.x-dev
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
matyo91 authored Aug 19, 2024
2 parents 2ea00d2 + 0747b2f commit bb3fe5a
Show file tree
Hide file tree
Showing 69 changed files with 4,077 additions and 2,377 deletions.
8 changes: 6 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
root = true # https://editorconfig.org

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{php,html,twig}]
indent_style = space
indent_size = 4
charset = utf-8

[*.md]
max_line_length = 80
indent_style = space
indent_size = 4

[{*.yml,*.yaml}]
indent_style = space
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v1.2.1

- Add new Interface Flow\AsyncHandlerInterface to control the Event::SYNC step when processing an IP
- Add Flow\AsyncHandler\AsyncHandler the default handler when Event::SYNC is dispatched
- Add Batch IP with Flow\AsyncHandler\BatchAsyncHandler from
- https://speakerdeck.com/alli83/symfony-messenger-et-ses-messages-a-la-queleuleu-dot-dot-dot-et-sil-etait-temps-de-grouper
- https://wolfgang-klinger.medium.com/how-to-handle-messages-in-batches-with-symfony-messenger-c91b5aa1c8b1
- https://github.com/wazum/symfony-messenger-batch
- Add Flow\AsyncHandler\DeferAsyncHandler to gain granular control on the async Event::SYNC step event
- Flow\Flow\YFlow rework
- Add more exemples in `examples/yflow.php` to play with Y-Combinators
- Update DX for Flow\DriverInterface : add `defer` to gain much granular control on asynchronous callbacks

## v1.2.0

- Add event system for processing IpStrategy
Expand All @@ -25,8 +38,8 @@
## v1.1.3

- Update DX for Flow\DriverInterface
- Update `async` that now $onResolve get called with async $callback result or Flow\Exception as first argument
- Update `tick` that now return a Closure to cleanup tick interval
- Update `async` that now $onResolve get called with async $callback result or Flow\Exception as first argument
- Update `tick` that now return a Closure to cleanup tick interval
- Add Flow\Driver\FiberDriver from https://github.com/jolicode/castor/blob/main/src/functions.php
- Upgrade to Symfony 6.3 and PHPUnit 10.3
- Refactor docs structure
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ First of all, **thank you** for contributing, **you are awesome**!

Everybody should be able to help. Here's how you can do it

- [Fork it](https://github.com/darkwood-fr/flow/fork)
- [Fork it](https://github.com/darkwood-com/flow/fork)
- Improve it
- Submit a [pull request](https://help.github.com/articles/creating-a-pull-request)

Expand Down Expand Up @@ -38,7 +38,7 @@ GitHub.
Then clone your fork:

```bash
git clone [email protected]:darkwood-fr/flow.git
git clone [email protected]:darkwood-com/flow.git
git checkout -b bug-or-feature-description
```

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ dev: ## Start dev server
docs-serve: ## Start documentation server locally
composer docs-serve

editorconfig-fixer: ## Fixes text files based on given .editorconfig declarations
composer editorconfig-fixer

infection: ## Run Infection
composer infection

Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://github.com/darkwood-fr/flow">
<a href="https://github.com/darkwood-com/flow">
<img src="docs/src/images/logo.png" width="auto" height="128px" alt="Flow">
</a>
</p>
Expand All @@ -14,7 +14,7 @@ Flow concept aims to solve

## Installation

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

```bash
Expand All @@ -41,26 +41,37 @@ class D3 {
public function __construct(public int $n3) {}
}

class D4 {
public function __construct(public int $n4) {}
}

$flow = Flow::do(static function() {
yield fn (D1 $data1) => 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, fn ($ip) => printf("my number %d\n", $ip->data->n3)); // display 'my number 10'
$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-fr.github.io/flow](https://darkwood-fr.github.io/flow)
[https://darkwood-com.github.io/flow](https://darkwood-com.github.io/flow)

## License

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
],
"require": {
"php": ">=8.3",
"symfony/event-dispatcher": "^7.0"
"symfony/event-dispatcher": "^7.0",
"symfony/messenger": "^7.0"
},
"require-dev": {
"amphp/amp": "^3.0",
"openswoole/ide-helper": "^22.1.5",
"react/async": "^4.2",
"react/async": "^4.3",
"spatie/async": "^1.6",
"symfony/doctrine-messenger": "^7.0",
"symfony/messenger": "^7.0",
"symfony/orm-pack": "^2.4"
},
"suggest": {
Expand Down
4 changes: 2 additions & 2 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "@darkwood-fr/flow",
"name": "@darkwood-com/flow",
"description": "Flow",
"author": {
"name": "Mathieu Ledru",
"email": "[email protected]"
},
"bugs": {
"url": "https://github.com/darkwood-fr/flow"
"url": "https://github.com/darkwood-com/flow"
},
"homepage": "https://github.com/darkwood-fr/flow/tree/1.x#readme",
"homepage": "https://github.com/darkwood-com/flow/tree/1.x#readme",
"keywords": [
"flow"
],
"version": "1.1.5",
"version": "1.2.1",
"browserslist": [
"defaults"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/darkwood-fr/flow.git"
"url": "https://github.com/darkwood-com/flow.git"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/config/_default/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseurl = "https://darkwood-fr.github.io/flow/"
baseurl = "https://darkwood-com.github.io/flow/"
canonifyURLs = false
disableAliases = true
disableHugoGeneratorInject = true
Expand Down
4 changes: 2 additions & 2 deletions docs/src/config/_default/menus/menus.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
[[social]]
name = "GitHub"
pre = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-github\"><path d=\"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22\"></path></svg>"
url = "https://github.com/darkwood-fr/flow"
url = "https://github.com/darkwood-com/flow"
post = "v0.1.0"
weight = 10

[[social]]
name = "Twitter"
pre = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-twitter\"><path d=\"M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z\"></path></svg>"
url = "https://twitter.com/darkwood_fr"
url = "https://twitter.com/darkwood_com"
weight = 20

# [[footer]]
Expand Down
10 changes: 5 additions & 5 deletions docs/src/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ description = "Assemble your code by adopting asynchronous as native implementat
## Open Graph
images = ["flow.png"]
ogLocale = "en_US"
domainTLD = "darkwood-fr.github.io"
domainTLD = "darkwood-com.github.io"
titleHome = "Doks Theme"

## Twitter Cards
twitterSite = "@darkwood_fr"
twitterSite = "@darkwood_com"
twitterCreator = "@matyo91"

## JSON-LD
Expand All @@ -31,9 +31,9 @@ schemaLogoHeight = 512
schemaImage = "flow.png"
schemaImageWidth = 1280
schemaImageHeight = 640
schemaTwitter = "https://twitter.com/darkwood_fr"
schemaTwitter = "https://twitter.com/darkwood_com"
schemaLinkedIn = ""
schemaGitHub = "https://github.com/darkwood-fr/flow"
schemaGitHub = "https://github.com/darkwood-com/flow"
schemaSection = "blog"

## Sitelinks Search Box
Expand Down Expand Up @@ -62,7 +62,7 @@ alertDismissable = true
alertText = "Introducing the Doks child theme, several DX + UX updates, and more! <a class=\"alert-link stretched-link\" href=\"https://getdoks.org/blog/doks-v0.2/\">Check out Doks v0.2</a>"

# Edit Page
docsRepo = "https://github.com/darkwood-fr/flow"
docsRepo = "https://github.com/darkwood-com/flow"
editPage = true

[options]
Expand Down
36 changes: 36 additions & 0 deletions docs/src/content/en/docs/getting-started/async-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: "Async Handler"
description: "Async Handler."
lead: "Async Handler."
date: 2020-10-13T15:21:01+02:00
lastmod: 2020-10-13T15:21:01+02:00
draft: false
images: []
menu:
docs:
parent: "getting-started"
weight: 35
toc: true
---

# Async Handler

When processing Flow at async step, you can choose a handler that will process asynchronously the Ip.

## AsyncHandler

This is the default one. Ip is async processed immediately.

## BatchAsyncHandler

This async process Ip as batch capability : the handler will wait for a certain amount of async messages ($batchSize) to be processed before pushing them.

## DeferAsyncHandler

This async process Ip to offer defer capability : the handler will pass [$data, $defer] as entry for the job. In that case, the job can fine control the async process. $defer is a callable that embark two callbacks
- an complete callback to store result
- an async callback to go to the next async call.

## Make your Async Handler

You can make your custom Ip strategy by implementing `Flow\AsyncHandlerInterface`
2 changes: 1 addition & 1 deletion docs/src/content/en/docs/getting-started/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ toc: true

# Changelog

Changelog can be found [https://github.com/darkwood-fr/flow/blob/1.x/CHANGELOG.md](https://github.com/darkwood-fr/flow/blob/1.x/CHANGELOG.md)
Changelog can be found [https://github.com/darkwood-com/flow/blob/1.x/CHANGELOG.md](https://github.com/darkwood-com/flow/blob/1.x/CHANGELOG.md)
4 changes: 2 additions & 2 deletions docs/src/content/en/docs/getting-started/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Flow concept aims to solve

## Installation

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

```bash
Expand All @@ -44,7 +44,7 @@ Messaging part require to install [Docker](https://www.docker.com) and execute `

## Documentation

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

## License

Expand Down
1 change: 1 addition & 0 deletions docs/src/content/en/docs/getting-started/ressources.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Video of Y-Combinator : [https://www.youtube.com/watch?v=QSS_ZcO8Q1g](https://ww
- Lambda calculus language explanation : [https://tgdwyer.github.io/lambdacalculus](https://tgdwyer.github.io/lambdacalculus)
- Combinator : [https://github.com/loophp/combinator](https://github.com/loophp/combinator)
- Lambda-php : [https://github.com/igorw/lambda-php](https://github.com/igorw/lambda-php)
- Deriving the y combinator in 7 easy steps : [https://gist.github.com/igstan/388351](https://gist.github.com/igstan/388351)

## Messaging approach with East oriented code from [Frédéric Hardy](https://twitter.com/mageekguy)

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/en/privacy-policy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ __TLDR__: We do not use cookies and we do not collect any personal data.

### Information we collect and what we use it for

We run [Matomo](https://matomo.org/) analytics on darkwood-fr.github.io. The following information is collected:
We run [Matomo](https://matomo.org/) analytics on darkwood-com.github.io. The following information is collected:

- __Page URL__. We track the page URL of each page view on this website. We use this to understand which pages have been viewed and how many times a particular page has been viewed. For example: _https://darkwood-fr.github.io/flow/_.
- __Page URL__. We track the page URL of each page view on this website. We use this to understand which pages have been viewed and how many times a particular page has been viewed. For example: _https://darkwood-com.github.io/flow/_.
- __HTTP Referrer__. We use the referrer string to understand the number of visitors referred to this website from links on other sites. For example: _https://github.com/_.
- __Browser__. We use this to understand what browsers people use when visiting this website. This is derived from the User-Agent HTTP header. The full User-Agent is discarded. For example: _Brave_.
- __Operating system__. We use this to understand what operating systems people use when visiting this website. We only use the brand of the operating system and don’t include the version number or any other details. This is derived from the User-Agent HTTP header. The full User-Agent is discarded. For example: _GNU/Linux_.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 class="mt-0">{{ .Title }}</h1>
<div class="col-lg-9 col-xl-8 text-center">
<p class="lead">{{ .Params.lead | safeHTML }}</p>
<a class="btn btn-primary btn-lg px-4 mb-2" href="{{ "docs/getting-started/introduction/" | relLangURL }}" role="button">{{ i18n "get-started" }}</a>
<p class="meta">Open-source MIT Licensed. <a href="https://github.com/darkwood-fr/flow">GitHub v{{ $data := getJSON "https://raw.githubusercontent.com/darkwood-fr/flow/1.x/docs/package.json" }}{{ $data.version }}</a></p>
<p class="meta">Open-source MIT Licensed. <a href="https://github.com/darkwood-com/flow">GitHub v{{ $data := getJSON "https://raw.githubusercontent.com/darkwood-com/flow/1.x/docs/package.json" }}{{ $data.version }}</a></p>
</div>
</div>
</section>
Expand Down
6 changes: 3 additions & 3 deletions docs/theme.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name = "Flow"
license = "MIT"
licenselink = "https://github.com/darkwood-fr/flow/blob/1.x/LICENSE"
licenselink = "https://github.com/darkwood-com/flow/blob/1.x/LICENSE"
description = "Assemble your code by adopting asynchronous as native implementation and build with functional programming and monads."
source = "docs"

homepage = "https://github.com/darkwood-fr/flow"
demosite = "https://darkwood-fr.github.io"
homepage = "https://github.com/darkwood-com/flow"
demosite = "https://darkwood-com.github.io"

tags = ["landing page", "documentation", "blog", "minimal", "modern", "customizable", "search", "dark mode", "bootstrap"]
features = ["security aware", "fast by default", "seo-ready", "development tools", "bootstrap framework", "netlify-ready", "full text search", "page layouts", "dark mode"]
Expand Down
2 changes: 1 addition & 1 deletion examples/Data/DataA.php → examples/Model/DataA.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\Examples\Data;
namespace Flow\Examples\Model;

readonly class DataA
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Data/DataB.php → examples/Model/DataB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\Examples\Data;
namespace Flow\Examples\Model;

readonly class DataB
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Data/DataC.php → examples/Model/DataC.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\Examples\Data;
namespace Flow\Examples\Model;

readonly class DataC
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Data/DataD.php → examples/Model/DataD.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\Examples\Data;
namespace Flow\Examples\Model;

readonly class DataD
{
Expand Down
Loading

0 comments on commit bb3fe5a

Please sign in to comment.