PHP code example of sitnikovik / clipher

1. Go to this page and download the library: Download sitnikovik/clipher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sitnikovik / clipher example snippets


$console = new \Sitnikovik\Console\Console();

\Sitnikovik\Console\Console::confirm(string $question, bool $yesOnDefault = false): void

\Sitnikovik\Console\Console::prompt(string $question): string

\Sitnikovik\Console\Console::println(string $text): void

\Sitnikovik\Console\Console::separate(int $width = 0): void

\Sitnikovik\Console\Console::quit(string $message = '')

\Sitnikovik\Console\Console::panic(string $message = '', int $code = 1)

// set colors
$console->setTextStyle(new Sitnikovik\Console\Style\Text\Bold());
$console->setBackgroundStyle(new Sitnikovik\Console\Style\Background());

// or via constructor
$console = new Console(new Sitnikovik\Console\Style\Text\Regular(), new Sitnikovik\Console\Style\Background());

$text = $console->red('some text'); // colorize text
// or
$text = $console->bgRed('some text'); // set background to text

// Create the bar like that
$maxValue = 100;
$progressbar = $console::createProgressbar($maxValue);
// or 
$progressbar = Sitnikovik\Console\Progressbar\Progressbar($maxValue);

// Advancing
for ($current = 0; $current < $maxValue; $current++) {
    $progressbar->advance(); // increment with 1 point of the max value
}

// Or advance it manually
$progressbar->advance(40); // or another value