diff --git a/README.md b/README.md index af9d02b..d1220e9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ It wraps a given `ReadableStreamInterface` and exposes its plain data through the same interface. ```php -$stdin = new Stream(STDIN, $loop); +$stdin = new ReadableResourceStream(STDIN, $loop); $stream = new ControlCodeParser($stdin); diff --git a/composer.json b/composer.json index 3da822d..cf8eccc 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ }, "require-dev": { "phpunit/phpunit": "^5.0 || ^4.8", - "react/event-loop": "^0.4 || ^0.3" + "react/event-loop": "^0.4 || ^0.3", + "react/stream": "^0.6" } } diff --git a/examples/random-colors.php b/examples/random-colors.php index 6d0e67c..8673391 100644 --- a/examples/random-colors.php +++ b/examples/random-colors.php @@ -11,9 +11,10 @@ // with random colors: // $ phpunit --color=always | php random-colors.php -use React\Stream\Stream; use React\EventLoop\Factory; use Clue\React\Term\ControlCodeParser; +use React\Stream\ReadableResourceStream; +use React\Stream\WritableResourceStream; require __DIR__ . '/../vendor/autoload.php'; @@ -25,11 +26,10 @@ } // process control codes from STDIN -$stdin = new Stream(STDIN, $loop); +$stdin = new ReadableResourceStream(STDIN, $loop); $parser = new ControlCodeParser($stdin); -$stdout = new Stream(STDOUT, $loop); -$stdout->pause(); +$stdout = new WritableResourceStream(STDOUT, $loop); // pass all c0 codes through to output $parser->on('c0', array($stdout, 'write')); diff --git a/examples/remove-codes.php b/examples/remove-codes.php index a4e0242..c87b2ca 100644 --- a/examples/remove-codes.php +++ b/examples/remove-codes.php @@ -8,9 +8,10 @@ // codes like this: // $ phpunit --color=always | php remove-codes.php -use React\Stream\Stream; use React\EventLoop\Factory; use Clue\React\Term\ControlCodeParser; +use React\Stream\ReadableResourceStream; +use React\Stream\WritableResourceStream; require __DIR__ . '/../vendor/autoload.php'; @@ -22,13 +23,11 @@ } // process control codes from STDIN -$stdin = new Stream(STDIN, $loop); +$stdin = new ReadableResourceStream(STDIN, $loop); $parser = new ControlCodeParser($stdin); -$stdout = new Stream(STDOUT, $loop); -$stdout->pause(); - // pipe data from STDIN to STDOUT without any codes +$stdout = new WritableResourceStream(STDOUT, $loop); $parser->pipe($stdout); // only forward \r, \n and \t diff --git a/examples/stdin-codes.php b/examples/stdin-codes.php index 3362f1d..f0d8d76 100644 --- a/examples/stdin-codes.php +++ b/examples/stdin-codes.php @@ -9,9 +9,9 @@ // codes like this: // $ phpunit --color=always | php stdin-codes.php -use React\Stream\Stream; use React\EventLoop\Factory; use Clue\React\Term\ControlCodeParser; +use React\Stream\ReadableResourceStream; require __DIR__ . '/../vendor/autoload.php'; @@ -23,7 +23,7 @@ } // process control codes from STDIN -$stdin = new Stream(STDIN, $loop); +$stdin = new ReadableResourceStream(STDIN, $loop); $parser = new ControlCodeParser($stdin); $decoder = function ($code) {