This package is a pure PHP alternative to expect, the Unix tool. This package doesn't depend on the PECL package either.
Expect lets you script interactions with interactive terminal applications.
The original author wrote this "because I wrote an interactive CLI program and needed to write automated tests for it. Apparently people use the real expect for scripting ftp and telnet workflows, so I guess you could use it for that too."
I have modified this for my own uses.
For now, copy the Expect.php file to your own project and use include_once with the path of the file to add it
This version does not support chaining of commands. It follows the program flow as defined within your php application.
There is an example in the source file Expect.php