Skip to content

Commit ffad1ae

Browse files
committed
Prepare v0.1.2 release
1 parent 6a7d285 commit ffad1ae

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 0.1.2 (2018-05-11)
4+
5+
* Feature: Limit buffer size to 64 KiB by default.
6+
(#10 by @clue)
7+
8+
* Feature: Forward compatiblity with EventLoop v0.5 and upcoming v1.0.
9+
(#8 by @clue)
10+
11+
* Fix: Return bool `false` if encoding fails due to invalid value to pause source.
12+
(#9 by @clue)
13+
14+
* Improve test suite by supporting PHPUnit v6 and test against legacy PHP 5.3 through PHP 7.2.
15+
(#7 by @clue)
16+
17+
* Update project homepage.
18+
(#11 by @clue)
19+
320
## 0.1.1 (2017-05-22)
421

522
* Feature: Forward compatibility with Stream v0.7, v0.6, v0.5 and upcoming v1.0 (while keeping BC)

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# clue/reactphp-ndjson [![Build Status](https://travis-ci.org/clue/reactphp-ndjson.svg?branch=master)](https://travis-ci.org/clue/reactphp-ndjson)
22

3-
Streaming newline delimited JSON ([NDJSON](http://ndjson.org/)) parser and encoder, built on top of React PHP
3+
Streaming newline delimited JSON ([NDJSON](http://ndjson.org/)) parser and encoder for ReactPHP.
44

55
**Table of Contents**
66

@@ -24,23 +24,24 @@ and exposes its data through the same interface, but emits the JSON elements
2424
as parsed values instead of just chunks of strings:
2525

2626
```
27-
{"name":"test","active":true}\r\n
28-
"hello w\u00f6rld"\r\n
27+
{"name":"test","active":true}
28+
{"name":"hello w\u00f6rld","active":true}
2929
```
30+
3031
```php
3132
$stdin = new ReadableResourceStream(STDIN, $loop);
3233

3334
$stream = new Decoder($stdin);
3435

3536
$stream->on('data', function ($data) {
36-
// data is a parsed element form the JSON stream
37+
// data is a parsed element from the JSON stream
3738
// line 1: $data = (object)array('name' => 'test', 'active' => true);
38-
// line 2: $data = "hello wörld";
39+
// line 2: $data = (object)array('name' => 'hello wörld', 'active' => true);
3940
var_dump($data);
4041
});
4142
```
4243

43-
React's streams emit chunks of data strings and make no assumption about their lengths.
44+
ReactPHP's streams emit chunks of data strings and make no assumption about their lengths.
4445
These chunks do not necessarily represent complete JSON elements, as an
4546
element may be broken up into multiple chunks.
4647
This class reassembles these elements by buffering incomplete ones.
@@ -115,7 +116,7 @@ Please note that the `Decoder` emits decoded/parsed data events, while many
115116
$stream->pipe($logger);
116117
```
117118

118-
For more details, see React's
119+
For more details, see ReactPHP's
119120
[`ReadableStreamInterface`](https://github.com/reactphp/stream#readablestreaminterface).
120121

121122
### Encoder
@@ -133,11 +134,11 @@ $stdout = new WritableResourceStream(STDOUT, $loop);
133134
$stream = new Encoder($stdout);
134135

135136
$stream->write(array('name' => 'test', 'active' => true));
136-
$stream->write('hello wörld');
137+
$stream->write(array('name' => 'hello wörld', 'active' => true));
137138
```
138139
```
139-
{"name":"test","active":true}\r\n
140-
"hello w\u00f6rld"\r\n
140+
{"name":"test","active":true}
141+
{"name":"hello w\u00f6rld","active":true}
141142
```
142143

143144
The `Encoder` supports the same parameters as the underlying
@@ -151,13 +152,13 @@ $stream = new Encoder($stdout, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
151152
$stream->write('hello wörld');
152153
```
153154
```
154-
"hello wörld"\r\n
155+
"hello wörld"
155156
```
156157

157158
Note that trying to pass the `JSON_PRETTY_PRINT` option will yield an
158159
`InvalidArgumentException` because it is not compatible with NDJSON.
159160

160-
If the underlying stream emits an `error` event or the given datacontains
161+
If the underlying stream emits an `error` event or the given data contains
161162
any data that can not be represented as a valid NDJSON stream,
162163
it will emit an `error` event and then `close` the input stream:
163164

@@ -191,10 +192,9 @@ its underlying stream:
191192
$stream->close();
192193
```
193194

194-
For more details, see React's
195+
For more details, see ReactPHP's
195196
[`WritableStreamInterface`](https://github.com/reactphp/stream#writablestreaminterface).
196197

197-
198198
## Install
199199

200200
The recommended way to install this library is [through Composer](https://getcomposer.org).
@@ -203,7 +203,7 @@ The recommended way to install this library is [through Composer](https://getcom
203203
This will install the latest supported version:
204204

205205
```bash
206-
$ composer require clue/ndjson-react:^0.1.1
206+
$ composer require clue/ndjson-react:^0.1.2
207207
```
208208

209209
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

0 commit comments

Comments
 (0)