9

Is there a Windows equivalent of ncurses for PHP?

I've created a CLI script and want to display various statistics (currently processed record, completion percentage etc.) in a nice way, without outputting loads and heaps of text to the cmd.exe window.

The ncurses extension doesn't work on Windows.

demonkoryu
  • 1,247
  • 10
  • 27
  • 2
    Looks like our best bet is pdcurses, once someone decides that it would be a good idea to make a PHP module for it. – Mark Tomlin Sep 20 '10 at 05:28
  • 1
    I think you're right. I'll leave this question open until then. – demonkoryu Sep 20 '10 at 17:10
  • 1
    In the last couple of years, Microsoft has added nearly complete, modern support for VT100 XTerm escape sequences to the Windows 10 console (it's not a flawless implementation but it's passable). I built a simple PHP class that emits a wide variety of XTerm-compatible sequences that seems to work fine on Windows 10: https://github.com/cubiclesoft/php-misc/blob/master/support/xterm.php It's not ncurses, but it can be used to output those statistics in your CLI script you were wanting a decade ago. – CubicleSoft Oct 28 '21 at 20:32
  • @CubicleSoft Thanks, now I feel I need to write an ETL program again – demonkoryu Oct 28 '21 at 21:21

2 Answers2

3

ncurses only works for unix-like environments so you can use cygwin but [Link outdated] looks promising. Check it out and let me know!

(Edit Apr 2016: removed the link as it's out of date and clicking on it takes you down a nasty path.)

Robbie
  • 17,605
  • 4
  • 35
  • 72
Adil Mehmood
  • 462
  • 3
  • 13
  • 1
    Thanks. I know about Cygwin, but I'm trying to do this with the native Windows console. It doesn't have to be ncurses, just an equivalent solution for Windows. – demonkoryu May 22 '10 at 10:30
2

There is pdcurses which I believe works in a windows console window. The aren't any PHP bindings so you would need to build your own.

Craig
  • 4,750
  • 22
  • 21