1
1
# clue/stdio-react [ ![ Build Status] ( https://travis-ci.org/clue/php-stdio-react.svg?branch=master )] ( https://travis-ci.org/clue/php-stdio-react )
2
2
3
- Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT), built on top of for React PHP
3
+ Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT),
4
+ built on top of for [ ReactPHP] ( https://reactphp.org ) .
4
5
5
- ** Table of Contents **
6
+ ** Table of contents **
6
7
7
8
* [ Quickstart example] ( #quickstart-example )
8
9
* [ Usage] ( #usage )
@@ -64,14 +65,14 @@ $stdio = new Stdio($loop);
64
65
65
66
See below for waiting for user input and writing output.
66
67
Alternatively, the ` Stdio ` is also a well-behaving duplex stream
67
- (implementing React 's ` DuplexStreamInterface ` ) that emits each complete
68
+ (implementing ReactPHP 's ` DuplexStreamInterface ` ) that emits each complete
68
69
line as a ` data ` event (including the trailing newline). This is considered
69
70
advanced usage.
70
71
71
72
#### Output
72
73
73
74
The ` Stdio ` is a well-behaving writable stream
74
- implementing React 's ` WritableStreamInterface ` .
75
+ implementing ReactPHP 's ` WritableStreamInterface ` .
75
76
76
77
The ` writeln($line) ` method can be used to print a line to console output.
77
78
A trailing newline will be added automatically.
@@ -102,7 +103,7 @@ You can `pipe()` any readable stream into this stream.
102
103
#### Input
103
104
104
105
The ` Stdio ` is a well-behaving readable stream
105
- implementing React 's ` ReadableStreamInterface ` .
106
+ implementing ReactPHP 's ` ReadableStreamInterface ` .
106
107
107
108
It will emit a ` line ` event for every line read from console input.
108
109
The event will contain the input buffer as-is, without the trailing newline.
@@ -143,7 +144,7 @@ $readline = $stdio->getReadline();
143
144
144
145
See above for waiting for user input.
145
146
Alternatively, the ` Readline ` is also a well-behaving readable stream
146
- (implementing React 's ` ReadableStreamInterface ` ) that emits each complete
147
+ (implementing ReactPHP 's ` ReadableStreamInterface ` ) that emits each complete
147
148
line as a ` data ` event (without the trailing newline). This is considered
148
149
advanced usage.
149
150
@@ -547,13 +548,24 @@ ob_start(function ($chunk) use ($stdio) {
547
548
The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
548
549
[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
549
550
551
+ This project follows [ SemVer] ( http://semver.org/ ) .
550
552
This will install the latest supported version:
551
553
552
554
``` bash
553
- $ composer require clue/stdio-react:^1.0
555
+ $ composer require clue/stdio-react:^1.1
554
556
```
555
557
556
- More details and upgrade guides can be found in the [ CHANGELOG] ( CHANGELOG.md ) .
558
+ See also the [ CHANGELOG] ( CHANGELOG.md ) for details about version upgrades.
559
+
560
+ This project aims to run on any platform and thus does not require any PHP
561
+ extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
562
+ HHVM.
563
+ It's * highly recommended to use PHP 7+* for this project.
564
+
565
+ Internally, it will use the ` ext-mbstring ` to count and measure string sizes.
566
+ If this extension is missing, then this library will use a slighty slower Regex
567
+ work-around that should otherwise work equally well.
568
+ Installing ` ext-mbstring ` is highly recommended.
557
569
558
570
Note that * Microsoft Windows is not supported* .
559
571
Due to platform inconsistencies, PHP does not provide support for reading from
@@ -571,7 +583,7 @@ See also [#18](https://github.com/clue/php-stdio-react/issues/18) for more detai
571
583
## Tests
572
584
573
585
To run the test suite, you first need to clone this repo and then install all
574
- dependencies [ through Composer] ( http ://getcomposer.org) :
586
+ dependencies [ through Composer] ( https ://getcomposer.org) :
575
587
576
588
``` bash
577
589
$ composer install
0 commit comments