The Symfony\Component\Process\Process class executes a command in a sub-process, taking care of the differences between operating system and escaping arguments to prevent security issues. It replaces PHP functions like exec, passthru, shell_exec and system. The getOutput() method always returns the whole content of the standard output of the command and getErrorOutput() the content of the error output. Alternatively, the getIncrementalOutput() and getIncrementalErrorOutput() methods return the new output since the last call. The clearOutput() method clears the contents of the output and clearErrorOutput() clears the contents of the error output. You can also use the Symfony\Component\Process\Process class with the for each construct to get the output while it is generated. By default, the loop waits for new output before going to the next iteration