- What is darkwood/flow and what problem does it solve?
- darkwood/flow is a PHP 8.5+ package for building asynchronous pipelines in a functional style. You define pipeline steps with generators, pass typed data through each stage using an Ip object, and call await() to wait for execution. It is not a Laravel-specific package, so evaluate it for async workflows rather than replacing core Laravel patterns.
- How do I install darkwood/flow in a Laravel project?
- Install it with Composer using composer require darkwood/flow. Your environment must run PHP 8.5 or newer, which is a key constraint for Laravel projects because many Laravel LTS releases support older PHP versions. After installation, use FlowFactory to create flows and review the bundled examples before integrating with Laravel.
- Does Flow support Laravel 10 or Laravel 11?
- Flow requires PHP 8.5+, while Laravel 10.x LTS typically supports PHP 8.2–8.3. That means you should not assume drop-in support for current Laravel LTS versions without upgrading PHP and retesting extensions and dependencies. Treat Laravel compatibility as an integration project, not a guaranteed out-of-the-box feature.
- Can I use Flow inside Laravel HTTP requests or middleware?
- Flow is a poor direct fit for Laravel's synchronous HTTP kernel and middleware stack because its coroutine-driven async model conflicts with the normal request/response lifecycle. If you need HTTP integration, plan an adapter or FlowMiddleware and isolate async flows carefully. For most teams, Flow is safer in CLI commands, queues, and background data pipelines.
- How do Flow pipelines pass typed data between steps?
- Flow steps are generator-yielded callables with typed parameters and return values. Data is wrapped in an Ip instance, and each stage receives the previous stage's output, allowing you to move typed DTOs through the pipeline. This functional style differs from Laravel's service-layer and dependency-injection patterns, so keep boundaries clear.
- How do I await a Flow pipeline after execution?
- After invoking the flow with an Ip payload, call $flow->await() to wait for the asynchronous pipeline to finish. This is shown in the README usage example. In Laravel, await points should be isolated in CLI or queue contexts to avoid blocking or conflicting with the web request cycle.
- Is Flow a replacement for Laravel queues or spatie/async?
- Flow is not a drop-in replacement for Laravel queues or spatie/async. It is better suited to complex async pipelines, recursive workflows, and typed data processing where a functional generator model helps. Keep simple jobs in Laravel Queues and use Flow only where its async pipeline model provides clear value.
- Which async drivers work with Flow in Laravel?
- The technical assessment points to Amp, React, and Swoole as the most compatible driver options for Laravel-adjacent async work, while Fiber and parallel approaches are more experimental. You may need a custom LaravelDriver or DriverInterface implementation to bridge with Laravel's event loop. Choose drivers that match your existing async stack and test them thoroughly.
- How should I test Flow pipelines in a Laravel application?
- Testing async flows is harder than testing synchronous Laravel services because coroutines introduce non-determinism. You will likely need to mock FlowFactory and driver implementations and design tests around deterministic await points and isolated Ip payloads. Run Flow tests in CLI or queue contexts rather than through Laravel's HTTP test stack.
- Is darkwood/flow production-ready for Laravel apps?
- Do not treat darkwood/flow as production-ready for Laravel without a proof of concept. The PHP 8.5 requirement, async error propagation, state isolation, and performance overhead versus Laravel Queues all need validation. Start with one recursive or data-processing workflow, benchmark it, and keep a rollback plan.