Skip to content

Are We Done Yet? Spice up your PHP-scripts with progress-bars and more!

License

Notifications You must be signed in to change notification settings

RobertWesner/awdy

Folders and files

NameName
Last commit message
Last commit date
Nov 9, 2024
Nov 9, 2024
Aug 24, 2024
Aug 24, 2024
Nov 9, 2024
Nov 9, 2024
Nov 9, 2024
Aug 22, 2024
Nov 9, 2024
Nov 9, 2024
Nov 9, 2024
Aug 24, 2024
Aug 23, 2024

Repository files navigation

AWDY

License: MIT

Are We Done Yet? Spice up your PHP-scripts with progress-bars and more!

Installation

Composer (preferred)

composer require robertwesner/awdy

Single file download

  1. Download /dist/AWDY.php.
  2. Include the bundled file in your script:
require __DIR__ . '/AWDY.php';

Require from URL

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;

Use

More details avaiable in the wiki page.

At the beginning of your script

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);

Change progress

// Only as percentage
AWDY::progress($i / $maxAmount);

// Including current and maximum value
AWDY::progress($i / $maxAmount, $i, $maxAmount);

Append to log

// Unformatted
AWDY::echo("This is some simple informative text!\n");

// Printf formatting
AWDY::printf('You are %d steps away from your destiny! ', $myNumber);

Templates

If the pre-defined templates are not to your liking, take a look at how to create your own.

JustProgress

00:00:23  418/1337 [==========>                      ] Memory[00.12%]:  15659904/134217728

Simple

.----------------------------------------------------------.
| 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!                              |
'----------------------------------------------------------'

Demo

Keeping it simple

Adding some color

Allows dynamic size

About

Are We Done Yet? Spice up your PHP-scripts with progress-bars and more!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages