Download the PHP package macroman/terminal-progress-bar without Composer
On this page you can find all versions of the php package macroman/terminal-progress-bar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macroman/terminal-progress-bar
More information about macroman/terminal-progress-bar
Files in macroman/terminal-progress-bar
Package terminal-progress-bar
Short Description Flexible ascii progress bar.
License GPL-3.0-or-later
Homepage https://github.com/MacroMan/PHPTerminalProgressBar
Informations about the package terminal-progress-bar
Flexible ascii progress bar.
Installation
Usage
First we create a Bar
, giving it a format
string
as well as the total
, telling the progress bar when it will
be considered complete. Then call tick()
when needed.
You can also use update(amount)
to set the current tick value instead of ticking each time there is an increment:
Options
These are properties in the object you can read/set:
symbolComplete
Completion character defaulting to "="symbolIncomplete
Incomplete character defaulting to " "throttle
Minimum time between updates in seconds defaulting to 0.016current
Current ticktotal
Same value passed in when initialisingsecondPrecision
Number of decimal digits to use in "seconds" unitspercentPrecision
Number of decimal digits to use in "percentage" unitspercent
(read only) Current percentage completioneta
(read only) Estimate seconds until completionrate
(read only) Number of ticks per secondelapsed
(read only) Seconds since initialisation
Tokens
These are tokens you can use in the format of your progress bar.
:bar
the progress bar itself:current
current tick number:total
total ticks:elapsed
time elapsed in seconds:percent
completion percentage:eta
estimated completion time in seconds:rate
rate of ticks per second
Format example
Interrupt example
To display a message during progress bar execution, use interrupt()
Symbols/Precision example
To change the symbols or precision used on the progress bar
Throttle example
The draw interval is throttled at once per 100ms for performance. You can change this value if desired, eg lower for a smoother animation or higher if your work is resource intensive.
License
See LICENSE