Process: running external programs from PHP without the pain

Running an external program from PHP and reading what it printed? shell_exec('git pull') and you're done. But that only covers the simplest case. The moment you need more — the exit code, errors kept separate from the regular output, a user-supplied argument passed safely, a timeout — shell_exec() runs out of road. And proc_open(), which can do all of it, has an API so unwelcoming that most people…