diversen/php-cli-spinners
最新稳定版本:v1.1.0
Composer 安装命令:
composer require diversen/php-cli-spinners
包简介
Show a cli spinner while executing a callback
关键字:
README 文档
README
Simple PHP library for displaying spinners in the terminal while running a callback function.
You will need to have the pcntl extension installed.
The library uses this collection of spinners:
The spinners can be seen in action here
If you don't have the pcntl extension installed, you can still use the library, but you will not see the spinner.
On windows use WSL. There may be some trouble using UTF-8 characters in the terminal on WSL.
In this case you can use the simpleDots or simpleDotsScrolling spinner.
How it works
The library will run a callback function in a separate process which displays the spinner. The main process will run the callback function and return the result.
Installation
composer require diversen/php-cli-spinners
Usage
<?php require_once "vendor/autoload.php"; use Diversen\Spinner; $spinner = new Spinner(spinner: 'simpleDots', message: "Loading"); $res = $spinner->callback(function () { sleep(2); return 42; }); echo "$res\n"; // 42
Examples
Clone:
git clone https://github.com/diversen/php-cli-spinners.git
See examples folder. E.g. run php examples/simple.php
License
MIT © Dennis Iversen
统计信息
- 总下载量: 4.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-28