Files
nih-php-command-builder/README.md

453 B

NIH PHP Command Builder

Simple command builder inspired by rust's std library.

<?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.