定制 ed9/php-indicators 二次开发

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

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

ed9/php-indicators

Composer 安装命令:

composer require ed9/php-indicators

包简介

PHP Indicators for command line interface (CLI)

README 文档

README

Latest Stable Version Total Downloads Travis CLI License

Indicator library

PHP Indicators for command line interface (CLI)

Dependency notice

To run this library you must have php 7.1 or greater.

Installation

This library can be found on packagist and installed using composer:

composer require ed9/php-indicators

Loading indicator

Enable loading indicator for your CLI application. View the full example usage code at: example.

loading preview

Indicator methods:

Initiate new loading instance by overwriting the total row count, the bar length and auto step increment straight from the constructor.

$loading = new \Edward\Indicator\Loading(100, 30, true);

Overwrite the bar length on demand

$loading->setBarLength(30);

Overwrite the total row count on demand

$loading->setTotal(100);

Overwrite the necessity for steps to be incremented on every ping automatically. If set to false, the script will not increment when ping is called but will rely on you to update via setCurrent()

$loading->setAutoIncrement(true);

You can change the current step even if auto increment is enabled, it will follow your input.

$loading->setCurrent(0);

Run ping on every row you are processing and it will output the string into your console if no argument is provided.

$loading->ping();

Alternatively you can provide a callable argument to process the output yourself.

  • The variables you will receive in the argument:
  • string - A formatted string that can be outputted
  • process.current - Integer representing current step
  • process.total - Integer representing total row count
  • percentageCompleted - Float represented completion percentage
  • elapsed.value - Time unit elapsed since initial ping
  • elapsed.format - Time format elapsed since initial ping (seconds,minutes,hours)
  • eta.value - Estimated time unit until completion
  • eta.format - Estimated time format until completion (seconds,minutes,hours)
$loading->ping(function ($info) use ($loading) {
    print $info['string'];
});

ed9/php-indicators 适用场景与选型建议

ed9/php-indicators 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 09 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ed9/php-indicators 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ed9/php-indicators 我们能提供哪些服务?
定制开发 / 二次开发

基于 ed9/php-indicators 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-27