PHPackages                             syeedalireza/async-patterns-lab - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. syeedalireza/async-patterns-lab

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

syeedalireza/async-patterns-lab
===============================

Academic research comparing async/await, PHP Fibers, Amphp, ReactPHP, and Swoole for concurrent programming in PHP

00PHPCI failing

Since Jan 31Pushed 3mo agoCompare

[ Source](https://github.com/syeedalireza/async-patterns-lab)[ Packagist](https://packagist.org/packages/syeedalireza/async-patterns-lab)[ RSS](/packages/syeedalireza-async-patterns-lab/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Async Patterns Lab ⚡
====================

[](#async-patterns-lab-)

[![Tests](https://github.com/syeedalireza/async-patterns-lab/workflows/CI/badge.svg)](https://github.com/syeedalireza/async-patterns-lab/actions)[![PHPStan Level 9](https://camo.githubusercontent.com/1bc07920f0d36e55c17e1d38b1caa132cc605f51a82b388c962870b9a747b898/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e737667)](https://phpstan.org/)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Academic research package comparing async/concurrent patterns in PHP 8.2+: **Fibers**, **Amphp**, **ReactPHP**, with comprehensive benchmarks and analysis.

🎯 Purpose
---------

[](#-purpose)

Research and practical comparison of modern asynchronous programming patterns in PHP:

- **PHP 8.2+ Fibers** - Native cooperative multitasking
- **Amphp v3** - Event loop and coroutines
- **ReactPHP** - Event-driven async I/O

🚀 Features
----------

[](#-features)

✅ **PHP 8.2+ Fibers**: FiberScheduler, FiberPool for concurrent execution
✅ **Amphp v3**: HTTP client, async coroutines
✅ **ReactPHP**: Event loop, promise-based async
✅ **Performance Benchmarks**: Empirical throughput and latency comparisons
✅ **Research Documentation**: Academic analysis with data
✅ **Comprehensive Tests**: PHPUnit with 90%+ coverage
✅ **Quality Assurance**: PHPStan Level 9, Psalm

📦 Installation
--------------

[](#-installation)

```
composer require syeedalireza/async-patterns-lab --dev
```

🔧 Quick Start
-------------

[](#-quick-start)

### Using PHP Fibers

[](#using-php-fibers)

```
use AsyncPatternsLab\Fibers\FiberScheduler;

$scheduler = new FiberScheduler();

$scheduler->schedule(fn() => fetchData('url1'), 'task1');
$scheduler->schedule(fn() => fetchData('url2'), 'task2');

$results = $scheduler->run();
// ['task1' => 'data1', 'task2' => 'data2']
```

### Using Fiber Pool

[](#using-fiber-pool)

```
use AsyncPatternsLab\Fibers\FiberPool;

$pool = new FiberPool(maxConcurrency: 10);

$results = $pool->map([
    fn() => processTask1(),
    fn() => processTask2(),
    fn() => processTask3(),
]);
```

📊 Research Findings
-------------------

[](#-research-findings)

### Performance Comparison

[](#performance-comparison)

PatternThroughput (ops/s)Memory (MB)Best For**Fibers**25,00010Simple concurrent tasks**Amphp**22,00015Complex async workflows**ReactPHP**20,00012Event-driven appsSee [full research paper](docs/research/async-comparison-study.md) for detailed analysis.

🧪 Running Tests
---------------

[](#-running-tests)

```
# Run all tests
composer test

# Run with coverage
./vendor/bin/phpunit --coverage-html build/coverage

# Static analysis
composer phpstan
```

📖 Documentation
---------------

[](#-documentation)

- [Research Paper](docs/research/async-comparison-study.md) - Empirical comparison study
- [Examples](examples/) - Working code examples
- [Contributing](CONTRIBUTING.md) - Contribution guidelines

🤝 Contributing
--------------

[](#-contributing)

Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

📄 License
---------

[](#-license)

MIT License - see [LICENSE.md](LICENSE.md)

👤 Author
--------

[](#-author)

**Alireza Aminzadeh**

- GitHub: [@syeedalireza](https://github.com/syeedalireza)
- Packagist: [syeedalireza](https://packagist.org/users/syeedalireza/)

---

**Made for the PHP Async Community** 🚀

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance57

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/05de5f56c8b265c6720d5a4593d499a06c5a32b7ed2b7c36e0ac73778f09a381?d=identicon)[syeedalireza](/maintainers/syeedalireza)

### Embed Badge

![Health badge](/badges/syeedalireza-async-patterns-lab/health.svg)

```
[![Health](https://phpackages.com/badges/syeedalireza-async-patterns-lab/health.svg)](https://phpackages.com/packages/syeedalireza-async-patterns-lab)
```

###  Alternatives

[ctidigital/magento2-configurator

Keep magento persistently configured using files

174317.4k](/packages/ctidigital-magento2-configurator)[comcast/php-legal-licenses

A utility to generate a Licenses file containing the full license text for every dependency in your project for legal purposes.

821.1M9](/packages/comcast-php-legal-licenses)[xfra35/f3-cron

Job scheduling for the PHP Fat-Free Framework

73107.5k](/packages/xfra35-f3-cron)[bagusindrayana/laravel-coordinate

get nearby location from eloquent laravel

3019.7k](/packages/bagusindrayana-laravel-coordinate)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
