-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_progress.php
More file actions
32 lines (27 loc) · 933 Bytes
/
example_progress.php
File metadata and controls
32 lines (27 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require __DIR__ . '/../vendor/autoload.php';
$cli = new WizardCLI\WizardCLI(['theme' => 'wizard']);
$cli->art("WizardCLI Progress Demo");
// Simple progress: default advance (1 step each call)
$cli->color("Casting 100 spells:", "cyan+bold");
$cli->progressBar(100, "Casting spell...");
for ($i = 1; $i <= 100; $i++) {
usleep(20000); // 0.02 sec for demo
$cli->progressAdvance();
}
$cli->progressFinish();
$cli->color("\nCharging Mana (5 by 5):", "magenta+bold");
$cli->progressBar(100, "Charging Mana");
for ($i = 0; $i < 20; $i++) {
usleep(50000); // 0.05 sec
$cli->progressAdvance(5); // advance by 5 steps at a time
}
$cli->progressFinish();
$cli->color("\nShort Demo (custom theme):", "yellow+bold");
$cli = new WizardCLI\WizardCLI(['theme' => 'gold']);
$cli->progressBar(5, "Gold theme progress");
for ($i = 0; $i < 5; $i++) {
usleep(50000);
$cli->progressAdvance();
}
$cli->progressFinish();