Skip to content

Files

Latest commit

 

History

History
41 lines (28 loc) · 949 Bytes

README.md

File metadata and controls

41 lines (28 loc) · 949 Bytes

clue/stdio-react Build Status

Async standard console input & output (STDIN, STDOUT) for React PHP

Note: This project is in early alpha stage! Feel free to report any issues you encounter.

Quickstart example

Once installed, you can use the following code to present a prompt in a CLI program:

$stdio = new Stdio($loop);
$stdio->getReadline()->setPrompt('Input > ');

$stdio->on('line', function ($line) use ($stdio) {
    var_dump($line);
    
    if ($line === 'quit') {
        $stdio->end();
    }
});

See also the examples.

Install

The recommended way to install this library is through composer. New to composer?

{
    "require": {
        "clue/stdio-react": "dev-master"
    }
}

License

MIT