darkwood/flow
Flow is a PHP 8.5+ package for building asynchronous pipelines with a functional style. Define steps with generators, pass typed data through each stage, and await execution. Includes examples and docs, with a focus on assembling code as “flows”.
When using Flow, you can pass Closure or JobInterface, it's useful when you want to specialize your Job, that come with dependency injection.
ClosureJob simplifies job handling by allowing the use of closures or custom job classes, providing a versatile solution for managing jobs in your application.
The YJob class defines the Y combinator to recursively apply the job function, making it particularly useful in scenarios where you need to perform recursive tasks without explicitly writing recursive functions.
The LambdaJob class provides a way to evaluate lambda calculus expressions in PHP. It implements the Flow\JobInterface and allows you to:
Example usage:
<?php
$job = new LambdaJob('λx.x + 1');
$result = $job(5); // Returns 6
// Using with multiple parameters
$job = new LambdaJob('λx.λy.x + y');
$result = $job(5)(3); // Returns 8
The LambdaJob is particularly useful when you want to:
For more complex examples and detailed implementation, refer to the Lambda Interpreter article.
You can make your custom Job by implementing Flow\JobInterface.
How can I help you explore Laravel packages today?