Download the PHP package reactphp-x/channel without Composer
On this page you can find all versions of the php package reactphp-x/channel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download reactphp-x/channel
More information about reactphp-x/channel
Files in reactphp-x/channel
Download reactphp-x/channel
More information about reactphp-x/channel
Files in reactphp-x/channel
Vendor reactphp-x
Package channel
Short Description A Channel implementation for ReactPHP, similar to Swoole's Coroutine\Channel
License MIT
Package channel
Short Description A Channel implementation for ReactPHP, similar to Swoole's Coroutine\Channel
License MIT
Please rate this library. Is it a good library?
Informations about the package channel
ReactPHP Channel
一个基于 ReactPHP 的通道(Channel)实现,提供了类似 Go 语言的通道功能,支持异步通信、超时控制和等待组等功能。
特性
- 异步通道通信
- 支持带缓冲的通道
- 超时控制
- 通道关闭机制
- 等待组(WaitGroup)支持
- 完全基于 Promise 的异步操作
- 支持类似 Swoole 协程风格的编程
安装
使用示例
Channel 基本使用
协程风格使用
带超时的操作
WaitGroup 使用
带超时的 WaitGroup
API 文档
Channel
__construct(int $capacity = 1): 创建一个容量为$capacity的通道push($data, float $timeout = -1): 推送数据到通道,可设置超时pop(float $timeout = -1): 从通道弹出数据,可设置超时close(): 关闭通道isClosed(): 检查通道是否已关闭length(): 获取通道当前长度isEmpty(): 检查通道是否为空isFull(): 检查通道是否已满
WaitGroup
__construct(): 创建一个新的等待组add(int $delta = 1): 添加任务计数done(): 标记一个任务完成wait(float $timeout = -1): 等待所有任务完成,可设置超时count(): 获取当前任务计数
示例
更多示例请查看 examples 目录:
channel_examples.php: Channel 的基本使用示例waitgroup_examples.php: WaitGroup 的基本使用示例coroutine_style_examples.php: 协程风格的使用示例
许可证
MIT
All versions of channel with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.1
react/async Version ^4.0
react/event-loop Version ^1.4
react/promise Version ^3.0
react/promise-timer Version ^1.11
react/async Version ^4.0
react/event-loop Version ^1.4
react/promise Version ^3.0
react/promise-timer Version ^1.11
The package reactphp-x/channel contains the following files
Loading the files please wait ...