Too tired to write descriptive message

This commit is contained in:
2023-11-01 18:05:31 -04:00
commit fe9811bd24
14 changed files with 972 additions and 0 deletions

24
examples/basic.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(48);
$bar->display();
$bar->setColorToRed();
while($bar->getCurrentstep() < $bar->getSteps()) {
usleep(50000);
$bar->progress();
if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) {
$bar->setColorToYellow();
}
}
$bar->setColorToGreen();
$bar->display();
$bar->end();

24
examples/basicWithEta.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(100, 0, "Testing Text");
$bar->displayTimeRemaining()->display();
$bar->setColorToRed();
while($bar->getCurrentstep() < $bar->getSteps()) {
usleep(random_int(50000, 200000));
$bar->progress();
if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) {
$bar->setColorToYellow();
}
}
$bar->setColorToGreen();
$bar->display();
$bar->end();

View File

@@ -0,0 +1,25 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(48);
$bar->setBarLength(5);
$bar->display();
$bar->setColorToRed();
while($bar->getCurrentstep() < $bar->getSteps()) {
usleep(50000);
$bar->progress();
if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) {
$bar->setColorToYellow();
}
}
$bar->setColorToGreen();
$bar->display();
$bar->end();

View File

@@ -0,0 +1,24 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(48, 0, "Testing Text");
$bar->display();
$bar->setColorToRed();
while($bar->getCurrentstep() < $bar->getSteps()) {
usleep(50000);
$bar->progress();
if ($bar->getCurrentstep() >= ($bar->getSteps() / 2)) {
$bar->setColorToYellow();
}
}
$bar->setColorToGreen();
$bar->display();
$bar->end();

56
examples/colors.php Normal file
View File

@@ -0,0 +1,56 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(10, 3);
print("THIS WILL NOT WORK UNDER WINDOWS (PROBABLY)\n\n");
print("BLACK\n");
$bar->setColorToBlack();
$bar->display();
$bar->end();
print("\nRED\n");
$bar->setColorToRed();
$bar->display();
$bar->end();
print("\nGREEN\n");
$bar->setColorToGreen();
$bar->display();
$bar->end();
print("\nYELLOW\n");
$bar->setColorToYellow();
$bar->display();
$bar->end();
print("\nBLUE\n\n");
$bar->setColorToBlue();
$bar->display();
$bar->end();
print("\nMAGENTA\n\n");
$bar->setColorToMagenta();
$bar->display();
$bar->end();
print("\nCYAN\n\n");
$bar->setColorToCyan();
$bar->display();
$bar->end();
print("\nWHITE\n\n");
$bar->setColorToWhite();
$bar->display();
$bar->end();
print("\nDEFAULT\n\n");
$bar->setColorToDefault();
$bar->display();
$bar->end();
print("\nDONE!\n\n");

BIN
examples/img/terminal.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

8
examples/toString.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(10, 3);
print $bar . "\n";

10
examples/windows.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
use Siteworx\ProgressBar\CliProgressBar;
require_once('./../vendor/autoload.php');
$bar = new CliProgressBar(10, 3);
$bar->displayAlternateProgressBar();
$bar->display();
$bar->end();