feat: first impl

This commit is contained in:
2025-08-16 21:48:01 +02:00
parent e60ab9d7bc
commit 209c910f33
14 changed files with 444 additions and 0 deletions

26
example.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
use Nih\CommandBuilder\Command;
use Nih\CommandBuilder\Stdio;
require_once __DIR__ . '/vendor/autoload.php';
$output = (new Command('echo'))
->arg('-n')
->arg('-')
->arg("./ \$wow '''/stdout.txt")
->stderr(Stdio::null())
->output();
var_dump($output);
$child = (new Command('/usr/bin/cat'))
->stdin(Stdio::piped('r'))
->spawn(shell: true);
$child->stdin?->write('Hello, this is pretty cool.');
$child->stdin?->close();
$output = $child->output();
var_dump($output);