composer require robertwesner/awdy
- Download /dist/AWDY.php.
- Include the bundled file in your script:
require __DIR__ . '/AWDY.php';
If you wish to not use composer or manually download a file, you can add following code to your script:
$awdyPath = tempnam(sys_get_temp_dir(), 'awdy_');
file_put_contents($awdyPath, fopen('https://github.com/RobertWesner/awdy/releases/latest/download/AWDY.php', 'r'));
require $awdyPath;
More details avaiable in the wiki page.
Set up AWDY with your choice of template, optionally with a fixed width and height
// Dynamic size takes the full shell window and reacts to size changes
AWDY::setUp(new SimpleTemplate());
// Fixed width 80 and height 32
AWDY::setUp(new SimpleTemplate(), 80, 32);
// Only as percentage
AWDY::progress($i / $maxAmount);
// Including current and maximum value
AWDY::progress($i / $maxAmount, $i, $maxAmount);
// Unformatted
AWDY::echo("This is some simple informative text!\n");
// Printf formatting
AWDY::printf('You are %d steps away from your destiny! ', $myNumber);
If the pre-defined templates are not to your liking, take a look at how to create your own.
00:00:23 418/1337 [==========> ] Memory[00.12%]: 15659904/134217728
.----------------------------------------------------------.
| 13370/13370 [==========================================] |
+----------------------------------------------------------+
| 0 is your lucky number! |
| 777 is your lucky number! |
| 1554 is your lucky number! |
| 2331 is your lucky number! |
| 3108 is your lucky number! |
| 3885 is your lucky number! |
| 4662 is your lucky number! |
| 5439 is your lucky number! |
| 6216 is your lucky number! |
| 6993 is your lucky number! |
| 7770 is your lucky number! |
| 8547 is your lucky number! |
| 9324 is your lucky number! |
| 10101 is your lucky number! |
| 10878 is your lucky number! |
| 11655 is your lucky number! |
| 12432 is your lucky number! |
| 13209 is your lucky number! |
'----------------------------------------------------------'