charm/loop
Composer 安装命令:
composer require charm/loop
包简介
Identical API for ReactPHP, Swoole, AMP and plain PHP.
README 文档
README
A minimal event loop implementation which automatically detects the ReactPHP, Amp and Swoole event loops
and integrates with them. If no event loop is found, it falls back to the built-in PHP register_shutdown_function() to create an event loop.
Interface
Charm\Loop::defer(callable $callback) is the primary function for adding operations to the event loop.
This function maps directly to the corresponding loop function in ReactPHP, Amp, Swoole or the internal
register_shutdown_function() event loop.
Charm\Loop::onReadable(resource $stream, callable $listener) will invoke the provided $listener as soon
as reading the $stream resource will no longer block. The $listener callback will not be invoked until
the next iteration of the event loop.
Charm\Loop::onWritable(resource $stream, callable $listener) will invoke the provided $listener as soon
as writing the $stream resource will no longer block. The $listener callback will not be invoked until the next iteraton of the event loop.
Charm\Loop::setTimeout(float $seconds, callable $callback) will invoke $callback after $seconds seconds.
Charm\Loop::setInterval(float $interval, callable $callback) will invoke $callback every $seconds second.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-28