-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfull_example.php
More file actions
69 lines (60 loc) · 2.15 KB
/
full_example.php
File metadata and controls
69 lines (60 loc) · 2.15 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require __DIR__ . '/../vendor/autoload.php';
// Theme banners
$themes = ["wizard", "sorcerer", "dark", "gold"];
foreach ($themes as $theme) {
$cli = new WizardCLI\WizardCLI(['theme' => $theme]);
$cli->art("Theme: " . ucfirst($theme));
$cli->color("This is a demonstration of the '{$theme}' theme.", $theme === "gold" ? "yellow+bold" : "magenta+bold");
echo PHP_EOL;
}
// Table Demo
$cli = new WizardCLI\WizardCLI(['theme' => 'wizard']);
$cli->color("🧙 Table Demo (Wizard Theme):", "cyan+bold");
$cli->table(["Name", "Class", "Power", "Realm"], [
["Gandalf", "White", "Lightning Strike", "Middle-earth"],
["Dumbledore", "Headmaster", "Phoenix Flame", "Hogwarts"],
["Saruman", "Grey", "Mind Control", "Isengard"]
]);
echo PHP_EOL;
// Color & Text Style Demo
$cli->color("Blue text", "blue");
$cli->color("Red and bold!", "red+bold");
$cli->color("Green + underline", "green+underline");
$cli->color("🌟 Magical Bold Magenta 🌟", "magenta+bold");
$cli->color("Grey dim", "gray+dim");
$cli->color("Cyan underline", "cyan+underline");
$cli->color("Bold Underlined Gold", "yellow+bold+underline");
$cli->color("Dim Blue", "blue+dim");
echo PHP_EOL;
// Loop through all colors/styles
$styles = ["red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray"];
foreach ($styles as $style) {
$cli->color("This is $style!", "$style+bold");
}
echo PHP_EOL;
// Progress Bar Demo
$cli->color("Progress Demo (Wizard Theme):", "cyan+bold");
$cli->progressBar(20, "Preparing magic");
for ($i = 0; $i < 20; $i++) {
usleep(35000);
$cli->progressAdvance();
}
$cli->progressFinish();
$cli->color("Gold Theme Progress:", "yellow+bold");
$cli = new WizardCLI\WizardCLI(['theme' => 'gold']);
$cli->progressBar(5, "Gold progress");
for ($i = 0; $i < 5; $i++) {
usleep(40000);
$cli->progressAdvance();
}
$cli->progressFinish();
echo PHP_EOL;
// Multilingual Table Demo
$cli = new WizardCLI\WizardCLI(['theme' => 'sorcerer']);
$cli->color("🧙 Multilingual Table (Sorcerer Theme):", "magenta+bold");
$cli->table(["Wizard", "Country", "Symbol"], [
["loop", "magic", "✨"],
["Sorcière", "France", "🔮"],
["Wizard", "England", "🦉"]
]);