Download the PHP package reactphp-x/asyncify without Composer
On this page you can find all versions of the php package reactphp-x/asyncify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package asyncify
Asyncify
一个基于ReactPHP的异步处理库,可以轻松地将同步代码转换为异步执行。
特性
- 简单易用的API
- 支持Promise和Stream两种异步模式
- 基于进程池的异步执行
- 自动管理进程生命周期
安装
基本用法
1. 异步执行并返回Promise
2. 异步读取文件
3. 流式处理
API
Asyncify::init($min, $max)
初始化进程池
$min
: 最小进程数$max
: 最大进程数
Asyncify::call(callable $callable, $isStream = false, $prioritize = 0)
异步执行一个函数
$callable
: 要执行的函数$isStream
: 是否以流的方式返回结果$prioritize
: 优先级
返回:
- 当
$isStream = false
时,返回Promise - 当
$isStream = true
时,返回Stream
注意事项
- 确保在使用前正确安装并配置ReactPHP相关依赖
- 异步执行的函数中不能访问外部变量的引用
- 对于长时间运行的任务,建议使用流式处理
许可证
MIT
All versions of asyncify with dependencies
PHP Build Version
Package Version
Requires
reactphp-x/process-manager Version
^1.0
The package reactphp-x/asyncify contains the following files
Loading the files please wait ....