定制 legionth/reactphp-progressbar 二次开发

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

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

legionth/reactphp-progressbar

Composer 安装命令:

composer require legionth/reactphp-progressbar

包简介

A way to create a progressbar stream with ReactPHP

README 文档

README

An event-driven progressbar stream that can be added to other streams to show its current progress.

Table of Contents

Usage

This stream can be integrate like any other ReactPHP Stream

$loop = Factory::create();

$progressBarStream = new ProgressbarStream();

$input = new React\Stream\WritableResourceStream(STDOUT, $loop);
$output = new React\Stream\ReadableResourceStream(STDIN, $loop);

$output->pipe($progressBarStream);

$progressBarStream->on('error', function ($errorMessage) {
    echo $errorMessage;
});

$progressBarStream->on('data', function ($progressBarString) use ($input) {
    $input->write($progressBarString . PHP_EOL);
});

$loop->addPeriodicTimer(1, function () use ($output) {
    $output->emit('data', array(1));
});

$loop->addPeriodicTimer(3, function () use ($output) {
    $output->emit('data', array(10));
});

$loop->run();

This example will update the progressbar every 1 second by 1 unit/percent and every 3 seconds by 10 units/percent. This example can be found in the examples folder.

The progressbar stream will never overflow the maximum value. The stream will end if the current value reaches or goes beyond the maximum value.

data-Event

The data event contains the visualization of the progress bar. The data emitted by this event is a string. This event will be emitted if the progressbar is updated.

currentValue-Event

The currentValue event contains the integer value of the current progressbar. This event will be emitted if the progressbar is updated.

maximumValue-Event

The maximumValue event contains the integer value of the maximum reachable value of the progressbar. This event will be emitted if the progressbar is updated.

Installation

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

$ composer require legionth/progressbar:^1.0

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固