I'm writing a little command line application in PHP, which emulates a shell. It needs to do some work with files, including edit them with it's own text editor (a basic one like nano in the *nix shell). I was wondering if this sort of thing already existed, or if I'd have to write my own.
To clarify: I'm looking for a command line text editor as a function, written in PHP.