PHP command line progress bar

Wed, Mar 10, 2010 11:33 AM
Was just looking through some code and came across this function I wrote some time ago. If you do a lot of your processing scripts in PHP like we do, you probably need to know what is going on sometimes. So, I made a progress bar for use on the cli. I thought I would share it.  Here is a video of it in action. And the code can be found here.
11 comments
Gravatar for Christian Weiske

Christian Weiske Says:

PEAR has a CLI progressbar library that also allows you to reset the CLi afterwards, plus a bunch of more options:
http://pear.php.net/package/Console_Progressbar

Gravatar for Brian Moon

Brian Moon Says:

Yeah, I almost made it a class, but that seemed really heavy for something so simple.

Gravatar for Toby

Toby Says:

eZ Components also has a quite advanced progress bar class: http://ezcomponents.org/docs/api/latest/introduction_ConsoleTools.html#progress-indication

Gravatar for Bertrand

Bertrand Says:

After using it a few times, I can confirm that the eZ Components progress bar library is indeed an excellent one, with an easy to use API.

Gravatar for Jérôme Macias

Jérôme Macias Says:

Thanks for this simple and usefull little piece of code.

Using librairy may be better but not in this case, this is just one function !

Gravatar for Bastien Helders

Bastien Helders Says:

As far as I understand, it is only for use on php console applications?

It might be the wrong place to ask, but is there some work done on a web application variant, maybe with some javascript?

Comments are disabled for this post.