Download the PHP package parallite/parallite-php without Composer
On this page you can find all versions of the php package parallite/parallite-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download parallite/parallite-php
More information about parallite/parallite-php
Files in parallite/parallite-php
Package parallite-php
Short Description Execute PHP closures in true parallel using pcntl_fork — zero dependencies
License MIT
Informations about the package parallite-php
Features
- True Parallel Execution —
pcntl_forkruns closures in separate processes simultaneously - Zero Dependencies — only PHP 8.3+ with
ext-pcntlandext-posix(built-in) - No Daemon, No Binary — no external process to install, start, or manage
- No Closure Serialization — forked processes inherit parent memory; closures run as-is
- Simple async/await API — familiar Promise-like interface with global helpers
- Promise Chaining — chainable
then(),catch(), andfinally()methods - Cross-platform — fork mode on Linux/macOS, automatic sequential fallback on Windows
- Benchmark Mode — optional per-task metrics (execution time, memory, CPU)
Requirements
- PHP 8.3+
- ext-pcntl (Linux/macOS — built-in, enables fork mode)
- ext-posix (Linux/macOS — built-in, enables fork mode)
Windows? Parallite works on Windows in sequential fallback mode (no
pcntl_fork). Parallel execution requires a Unix-like OS.
Installation
That's it. No binary to download, no daemon to start, no post-install scripts.
Quick Start
Documentation
- Quick Start Guide — Get up and running in minutes
- Installation — Requirements and setup
- Configuration — Benchmark mode and PHP includes
- API Reference — Complete API documentation
- Complex Data Handling — How to handle complex data structures
- Troubleshooting — Common issues and solutions
- Examples — Real-world usage examples
Performance
Parallite provides significant speedup for I/O-bound and CPU-bound tasks:
| Tasks | Sequential | Parallel | Speedup |
|---|---|---|---|
| 3 × 1s | 3.0s | ~1.0s | 3.0x |
| 5 × 2s | 10.0s | ~2.0s | 5.0x |
| 10 × 1s | 10.0s | ~1.0s | 10.0x |
Example using the Filamentphp demo
Project with + 20 thousand orders, simulating several heavy calculations and with json transformation, as if it were for a heavy dashbaord (when I have time, I'll add this demo project to git):
✅ With Parallite:
🚫 Without Parallite:
The increase was approximately 321.4% in orders processed per second.
Real-World Example
Platform Support
| Platform | Status | Notes |
|---|---|---|
| Linux | ✅ Fully Supported | Fork mode (parallel) |
| macOS | ✅ Fully Supported | Fork mode (parallel) |
| Windows | ⚠️ Sequential Mode | No pcntl_fork — runs closures sequentially |
Troubleshooting
Having issues? Check the Troubleshooting Guide for solutions.
Quick tip: Use pd() inside async() calls — it throws an exception with the dump data.
How It Works
Parallite uses pcntl_fork() to create child processes that inherit the parent's entire memory space. This means:
- No closure serialization — closures run directly in the forked process
- No external daemon — each
async()call forks immediately - No startup overhead — fork is near-instantaneous (~0.1ms)
- Simple IPC — child writes result to a temp file, parent reads it on
await()
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Credits
- Inspired by: Pokio
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
All versions of parallite-php with dependencies
ext-pcntl Version *
ext-posix Version *