amphp/parallel
True parallel processing for PHP with AMPHP: run blocking work in worker processes or threads without blocking the event loop and without extensions. Includes non-blocking concurrency tools plus an opinionated worker pool API for submitting tasks and awaiting results.
pcntl or pthreads.amphp/http-client), enabling gradual adoption of event-driven PHP. Useful for teams migrating from synchronous to async codebases.amphp/cluster for inter-process communication (IPC) in microservices.amphp/http-client). Overhead of process/thread creation may not justify gains.ext-parallel or pthreads directly.amphp/cluster for socket sharing or redesign tasks to be stateless.pcntl/posix extensions (required for processes). Threads require PHP 8.2+ ZTS + ext-parallel.ReactPHP or Swoole for event loops without process management.php-ffmpeg, imagick, or native extensions for domain-specific parallelism."This package lets us scale PHP applications horizontally by offloading blocking tasks to parallel workers—without rewriting core logic. For example, we could process 10x more user uploads simultaneously by running image resizing in separate processes, freeing up our main servers for other requests. It’s a drop-in solution (MIT license, no extensions required for basic use) that aligns with our async PHP roadmap, reducing technical debt while improving performance under load. Early adopters like [hypothetical company] saw 30% faster batch jobs with minimal code changes."
"amphp/parallel gives us a production-ready way to run PHP tasks in parallel using processes/threads*, with:
amphp/http-client and cluster for distributed systems.ext-parallel.Use Cases:
pcntl_fork hacks with a maintained, feature-rich alternative.Tradeoffs:
Next Steps:
shell_exec/exec calls with Task implementations.WorkerPool for dynamic workloads (e.g., API rate limits).Alternatives Considered:
pthreads: Less mature, no async integration.Swoole: Overkill for pure parallelism (focuses on coroutines).pcntl: Error-prone, no task management.Recommendation: Adopt for CPU/I/O-bound parallelism; pair with amphp/http-client for async I/O."*
How can I help you explore Laravel packages today?