zeptech / fun-box
功能集合
dev-master
2014-07-10 14:12 UTC
Requires
- php: >=5.4.0
- zeptech/utility: dev-master
This package is not auto-updated.
Last update: 2024-09-14 13:58:23 UTC
README
一组有用的实用功能。
安装
通过 Composer 安装
{
"require": {
"zeptech/fun-box": "dev-master"
}
}
初始化
为了使用 Fun Box 的功能,必须先初始化,因为 PHP 不提供函数自动加载。初始化后,使用 ensureFn
函数包含功能。
<?php
// ... Initialize composer
FunBox::init();
ensureFn('passwordPrompt');
// ...
if ($interactive) {
$pw = passwordPrompt();
}
功能
Fun Box 提供的功能列表
announceWait
输出到命令行的倒计时。
announceWait($waitTime, $message = 'Commencing');
- @param waitTime integer 倒计时前的秒数。
- @param message string 倒计时完成后将发生什么。
passwordPrompt
从命令行提示用户输入密码。
passwordPrompt($prompt = 'password: ');
- @param prompt string 用户的提示信息。