I have a personal project of building a PHP sandbox in order to build a PHP interactive course. I want to to achieve something like Codeshcool's Ruby, JavaScript and Git courses or Codeacademy's PHP course in the sense of having a PHP REPL and terminal where you can run PHP statements and scripts, respectively.
The main goal is building a tool for people new to PHP and of course share it with the world which would make it a win-win project.
What technology would serve me best? Is there some library I can use for building the REPL/terminal? I was thinking JavaScript so I can embed this to the browser, maybe passing commands to the PHP interpreter from JavaScript code but I don't know if this is nonsense.