|
1 | 1 | php-shellcommand |
2 | | -=========== |
| 2 | +================ |
3 | 3 |
|
4 | 4 | [](https://github.com/mikehaertl/php-shellcommand/actions) |
5 | 5 | [](https://packagist.org/packages/mikehaertl/php-shellcommand) |
@@ -61,15 +61,15 @@ $command->addArg('--name=', "d'Artagnan"); |
61 | 61 |
|
62 | 62 | // Add argument with several values |
63 | 63 | // results in --keys key1 key2 |
64 | | -$command->addArg('--keys', array('key1','key2')); |
| 64 | +$command->addArg('--keys', ['key1','key2']); |
65 | 65 | ``` |
66 | 66 |
|
67 | 67 | ### Pipe Input Into Command |
68 | 68 |
|
69 | 69 | From string: |
70 | 70 | ```php |
71 | 71 | <?php |
72 | | -$command = new ('jq') // jq is a pretty printer |
| 72 | +$command = new ('jq'); // jq is a pretty printer |
73 | 73 | $command->setStdIn('{"foo": 0}'); |
74 | 74 | if (!$command->execute()) { |
75 | 75 | echo $command->getError(); |
@@ -115,19 +115,19 @@ fclose($fh); |
115 | 115 | ```php |
116 | 116 | <?php |
117 | 117 | // Create command with options array |
118 | | -$command = new Command(array( |
| 118 | +$command = new Command([ |
119 | 119 | 'command' => '/usr/local/bin/mycommand', |
120 | 120 |
|
121 | 121 | // Will be passed as environment variables to the command |
122 | | - 'procEnv' => array( |
| 122 | + 'procEnv' => [ |
123 | 123 | 'DEMOVAR' => 'demovalue' |
124 | | - ), |
| 124 | + ], |
125 | 125 |
|
126 | 126 | // Will be passed as options to proc_open() |
127 | | - 'procOptions' => array( |
| 127 | + 'procOptions' => [ |
128 | 128 | 'bypass_shell' => true, |
129 | | - ), |
130 | | -)); |
| 129 | + ], |
| 130 | +]); |
131 | 131 | ``` |
132 | 132 |
|
133 | 133 | ## API |
@@ -185,7 +185,7 @@ pass `command`, `execCommand` and `args` as options. This will call the respecti |
185 | 185 | and `=`, the (optional) `$value` will be separated by a space. The key will get |
186 | 186 | escaped if `$escapeArgs` is `true`. |
187 | 187 | * `$value`: The optional argument value which will get escaped if `$escapeArgs` is `true`. |
188 | | - An array can be passed to add more than one value for a key, e.g. `addArg('--exclude', array('val1','val2'))` |
| 188 | + An array can be passed to add more than one value for a key, e.g. `addArg('--exclude', ['val1','val2'])` |
189 | 189 | which will create the option "--exclude 'val1' 'val2'". |
190 | 190 | * `$escape`: If set, this overrides the `$escapeArgs` setting and enforces escaping/no escaping |
191 | 191 | * `setStdIn()`: String or resource to supply to command via standard input. |
|
0 commit comments