Skip to content

Commit b6963b7

Browse files
authored
Create full_example.php
1 parent 1022352 commit b6963b7

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

examples/full_example.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
require __DIR__ . '/../vendor/autoload.php';
3+
4+
// Theme banners
5+
$themes = ["wizard", "sorcerer", "dark", "gold"];
6+
foreach ($themes as $theme) {
7+
$cli = new WizardCLI\WizardCLI(['theme' => $theme]);
8+
$cli->art("Theme: " . ucfirst($theme));
9+
$cli->color("This is a demonstration of the '{$theme}' theme.", $theme === "gold" ? "yellow+bold" : "magenta+bold");
10+
echo PHP_EOL;
11+
}
12+
13+
// Table Demo
14+
$cli = new WizardCLI\WizardCLI(['theme' => 'wizard']);
15+
$cli->color("🧙 Table Demo (Wizard Theme):", "cyan+bold");
16+
$cli->table(["Name", "Class", "Power", "Realm"], [
17+
["Gandalf", "White", "Lightning Strike", "Middle-earth"],
18+
["Dumbledore", "Headmaster", "Phoenix Flame", "Hogwarts"],
19+
["Saruman", "Grey", "Mind Control", "Isengard"]
20+
]);
21+
echo PHP_EOL;
22+
23+
// Color & Text Style Demo
24+
$cli->color("Blue text", "blue");
25+
$cli->color("Red and bold!", "red+bold");
26+
$cli->color("Green + underline", "green+underline");
27+
$cli->color("🌟 Magical Bold Magenta 🌟", "magenta+bold");
28+
$cli->color("Grey dim", "gray+dim");
29+
$cli->color("Cyan underline", "cyan+underline");
30+
$cli->color("Bold Underlined Gold", "yellow+bold+underline");
31+
$cli->color("Dim Blue", "blue+dim");
32+
33+
echo PHP_EOL;
34+
35+
// Loop through all colors/styles
36+
$styles = ["red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray"];
37+
foreach ($styles as $style) {
38+
$cli->color("This is $style!", "$style+bold");
39+
}
40+
echo PHP_EOL;
41+
42+
// Progress Bar Demo
43+
$cli->color("Progress Demo (Wizard Theme):", "cyan+bold");
44+
$cli->progressBar(20, "Preparing magic");
45+
for ($i = 0; $i < 20; $i++) {
46+
usleep(35000);
47+
$cli->progressAdvance();
48+
}
49+
$cli->progressFinish();
50+
51+
$cli->color("Gold Theme Progress:", "yellow+bold");
52+
$cli = new WizardCLI\WizardCLI(['theme' => 'gold']);
53+
$cli->progressBar(5, "Gold progress");
54+
for ($i = 0; $i < 5; $i++) {
55+
usleep(40000);
56+
$cli->progressAdvance();
57+
}
58+
$cli->progressFinish();
59+
60+
echo PHP_EOL;
61+
62+
// Multilingual Table Demo
63+
$cli = new WizardCLI\WizardCLI(['theme' => 'sorcerer']);
64+
$cli->color("🧙 Multilingual Table (Sorcerer Theme):", "magenta+bold");
65+
$cli->table(["Wizard", "Country", "Symbol"], [
66+
["loop", "magic", ""],
67+
["Sorcière", "France", "🔮"],
68+
["Wizard", "England", "🦉"]
69+
]);

0 commit comments

Comments
 (0)