承接 phasty/stream 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

phasty/stream

Composer 安装命令:

composer require phasty/stream

包简介

PHP stream library

关键字:

README 文档

README

This component is wrapper for different kind of php streams

Usage

Classes of this package allow you to deal with such streams as files, sockets, pipes, i/o-streams and so on with ability to use them in non-blocking manner:

use Phasty\Stream\Stream;
use Phasty\Stream\StreamSet;
use Phasty\Stream\Timer;

// use wrapper for STDIN
$readStream = new Stream(STDIN);
// streamset allows you work with different streams at sames time tih interraptions for timers
$streamSet = StreamSet::instance();
$streamSet->addReadStream($readStream);
$readStream->on("data", function($event) use ($streamSet) {
    $data = $event->getData();
    if (trim($data) === "q") {
        $streamSet->stop();
        return;
    }
    echo "you wrote: " . $event->getData();
});
$timer = new Timer(2, 0, function() { 
    echo "Now: " . date("H:i:s"), "\n";
});
$streamSet->addTimer($timer);
$streamSet->listen();
echo "exiting\n";

You will get something like this:

Now: 20:52:11
dawd
you wrote: dawd
Now: 20:52:13
q
exiting

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固