定制 syeedalireza/async-patterns-lab 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

syeedalireza/async-patterns-lab

Composer 安装命令:

composer require syeedalireza/async-patterns-lab

包简介

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

README 文档

README

Tests PHPStan Level 9 License: MIT

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

🎯 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

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

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

🔧 Quick Start

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

use AsyncPatternsLab\Fibers\FiberPool;

$pool = new FiberPool(maxConcurrency: 10);

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

📊 Research Findings

Performance Comparison

Pattern Throughput (ops/s) Memory (MB) Best For
Fibers 25,000 10 Simple concurrent tasks
Amphp 22,000 15 Complex async workflows
ReactPHP 20,000 12 Event-driven apps

See full research paper for detailed analysis.

🧪 Running Tests

# Run all tests
composer test

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

# Static analysis
composer phpstan

📖 Documentation

🤝 Contributing

Contributions welcome! Please see CONTRIBUTING.md for details.

📄 License

MIT License - see LICENSE.md

👤 Author

Alireza Aminzadeh

Made for the PHP Async Community 🚀

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固