2017 © Pedro Peláez
 

library interactive-cli

PHP interactive CLI

image

gevman/interactive-cli

PHP interactive CLI

  • Tuesday, April 11, 2017
  • by gevorgmansuryan
  • Repository
  • 1 Watchers
  • 6 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHP Interactive CLI support

Latest Stable Version Latest Unstable Version License, (*1)

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);
}

The Versions

11/04 2017

dev-master

9999999-dev

PHP interactive CLI

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Gevorg Mansuryan

cli command line command line interface interactive interactive cli

11/04 2017

1.0.0

1.0.0.0

PHP interactive CLI

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Gevorg Mansuryan

cli command line command line interface interactive interactive cli