@@ -20,8 +20,11 @@ You can install the component in 2 different ways:
2020Usage
2121-----
2222
23- The :class: `Symfony\\ Component\\ Process\\ Process ` class allows you to execute
24- a command in a sub-process::
23+ The :class: `Symfony\\ Component\\ Process\\ Process ` class executes a command in a
24+ sub-process, taking care of the differences between operating system and
25+ escaping arguments to prevent security issues. It replaces PHP functions like
26+ :phpfunction: `exec `, :phpfunction: `passthru `, :phpfunction: `shell_exec ` and
27+ :phpfunction: `system `::
2528
2629 use Symfony\Component\Process\Process;
2730 use Symfony\Component\Process\Exception\ProcessFailedException;
@@ -36,8 +39,18 @@ a command in a sub-process::
3639
3740 echo $process->getOutput();
3841
39- The component takes care of the subtle differences between the different platforms
40- when executing the command.
42+ .. tip ::
43+
44+ In addition to passing the command binary and its arguments as a string, you
45+ can also pass them as an array, which is useful when building a complex
46+ command programmatically::
47+
48+ // traditional string based commands
49+ $builder = new Process('ls -lsa');
50+ // same example but using an array
51+ $builder = new Process(array('ls', '-lsa'));
52+ // the array can contain any number of arguments and options
53+ $builder = new Process(array('ls', '-l', '-s', '-a'));
4154
4255The ``getOutput() `` method always returns the whole content of the standard
4356output of the command and ``getErrorOutput() `` the content of the error
0 commit comments