amphp/pipeline
Fiber-safe concurrent iterators and collection operators for PHP 8.1+ using AMPHP. Build pipelines from iterables and consume them safely from multiple fibers with foreach or manual iteration, supporting async sets and concurrent processing.
Queue and buffer() methods.map/filter/reduce) for async workflows, reducing boilerplate for async iterators compared to manual Generator/Amp\Future handling.SplQueue), especially for latency-sensitive pipelines.map/filter chains) and benefits from a declarative API over manual Generator/Future management.amphp/http, amphp/parallel) and want to unify async data flows.ReactPHP or Swoole).array_map suffices; no async/fiber needs).For Executives:
"This package lets us process high-volume data streams (e.g., user events, sensor data) concurrently and efficiently in PHP, without blocking threads or risking race conditions. It’s like Unix pipes for async PHP: we can chain operations (map/filter), throttle producers to avoid overload, and scale horizontally—all while keeping code clean and maintainable. For example, we could replace a slow, synchronous batch job with a fiber-powered pipeline that handles 10x more requests with the same resources. It’s a strategic enabler for real-time features and cost-effective scaling."
For Engineers:
*"amphp/pipeline gives us a batteries-included way to build async data pipelines in PHP 8.1+. Key wins:
Iterator race conditions when multiple fibers access the same stream.Queue::push() blocks until consumers catch up), preventing memory spikes.map/filter/reduce like in JavaScript/Scala, but with PHP’s type safety.amphp/http, amphp/parallel, etc.
Example: Replace a clunky Generator + Amp\Future mess with a declarative pipeline like:Pipeline::fromIterable($apiResponses)
->concurrent(5) // Process 5 API calls at once
->map(fn ($res) => json_decode($res, true))
->filter(fn ($data) => $data['status'] === 'success')
->reduce(fn ($carry, $item) => $carry + $item['value'], 0);
Tradeoffs: Slight learning curve for fiber/async concepts, but pays off in scalability and code clarity."*
How can I help you explore Laravel packages today?