26 lines
453 B
Markdown
26 lines
453 B
Markdown
# NIH PHP Command Builder
|
|
|
|
Simple command builder inspired by rust's std library.
|
|
|
|
```php
|
|
<?php
|
|
|
|
use Nih\CommandBuilder\Command;
|
|
use Nih\CommandBuilder\Stdio;
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
$child = (new Command('cat'))
|
|
->stdin(Stdio::piped())
|
|
->stdout(Stdio::piped())
|
|
->spawn();
|
|
|
|
$child->stdin?->write('Hello, this is pretty cool.');
|
|
|
|
$output = $child->output();
|
|
|
|
echo $output->stdout;
|
|
|
|
// Hello, this is pretty cool.
|
|
```
|