gevman/interactive-cli PHP interactive CLI

commandlinecommandlineinterfaceinteractivecliinteractivecli

PHP Interactive CLI support

Latest Stable Version Latest Unstable Version License

Installation (using composer)

composer require gevman/interactive-cli

Class Gevman\Cli\Cli

bool confirm(string $prompt [, bool $default = true])

Interactive confirm - returns user selected value (Y=true, N=false)
  • $prompt - prompt message
  • $default - default value

void input(&$input [, string $message = ''] [, bool $required = false])

Interactive prompt for user input
  • $prompt - prompt message
  • $default - default value

Gevman\Cli\CliOutput output(string $str [, mixed $_ = null])

Outputs message
  • $str - message or pattern for sprintf
  • $_ - parameters for sprintf

Class Gevman\Cli\CliOutput

Gevman\Cli\CliOutput success()

Marks output green

Gevman\Cli\CliOutput warning()

Marks output Yellow

Gevman\Cli\CliOutput error()

Marks output Red

Gevman\Cli\CliOutput note()

Marks output Blue

Gevman\Cli\CliOutput endl()

Line break

Gevman\Cli\CliOutput cl()

Clear current line

void progressBar(mixed $all [, string $additionalInfo = ''])

Displays interactive progressbar (message should be current key)
  • $all - count of all
  • $additionalInfo - displays additional Info for each step
require '/path/to/autoload.php';

use Gevman\Cli\Cli;

//basic example
Cli::output('%s - %s', 'hello', 'world')->note()->endl()->output('yesimum')->error()->endl()->endl();

//pregressbar example
$all = 100000;
for ($step = 0; $step < 100000; $step++) {
    Cli::output($step + 1)->progressBar($all, $step);
}

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.0 is the latest of one release



MIT license
Stats
7 github stars & 0 github forks
0 downloads in the last day
1 downloads in the last 30 days
588 total downloads