Skip to content

Commit 8fbf5eb

Browse files
committed
Fix typos in readme
1 parent 2d82d42 commit 8fbf5eb

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

README.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ the built in `json_encode` function, there are two main advantages:
1212
memory, since the JSON document will be encoded value by value and it's
1313
possible to output the encoded document piece by piece.
1414

15-
In other words, the Streaming JSON encoder can provide the greatest benefit
16-
when you need handle large data sets that may otherwise take up too much memory
17-
to process.
15+
In other words, the Streaming JSON Encoder can provide the greatest benefit
16+
when you need to handle large data sets that may otherwise take up too much
17+
memory to process.
1818

1919
In order to increase interoperability, the library also provides a PSR-7
2020
compatible stream to use with frameworks and HTTP requests.
2121

22+
API documentation for the library can be generated using Sami and found
23+
[online](https://violet.riimu.net/api/streaming-json-encoder/).
24+
25+
[![Travis](https://img.shields.io/travis/violet-php/streaming-json-encoder.svg?style=flat-square)](https://travis-ci.org/violet-php/streaming-json-encoder)
26+
[![Scrutinizer](https://img.shields.io/scrutinizer/g/violet-php/streaming-json-encoder.svg?style=flat-square)](https://scrutinizer-ci.com/g/violet-php/streaming-json-encoder/)
27+
[![Scrutinizer Coverage](https://img.shields.io/scrutinizer/coverage/g/violet-php/streaming-json-encoder.svg?style=flat-square)](https://scrutinizer-ci.com/g/violet-php/streaming-json-encoder/)
28+
2229
## Requirements ##
2330

2431
In order to use this library, the following requirements must be met:
@@ -61,7 +68,7 @@ the installation.
6168
### Manual installation ###
6269

6370
If you do not wish to use Composer to load the library, you may also download
64-
the library manually by downloading the [latest release](https://github.com/violet/streaming-json-encoder/releases/latest)
71+
the library manually by downloading the [latest release](https://github.com/violet-php/streaming-json-encoder/releases/latest)
6572
and extracting the `src` folder to your project. You may then include the
6673
provided `src/autoload.php` file to load the library classes.
6774

@@ -109,10 +116,9 @@ foreach ($encoder as $string) {
109116
}
110117
```
111118

112-
It's also worth noting that the encoder also supports iterators for values.
113-
What's more, any closure passed to the encoder will also be called and the
114-
return value used as the value instead. The previous example could also be
115-
written as:
119+
It's also worth noting that the encoder supports iterators for values. What's
120+
more, any closure passed to the encoder will also be called and the return value
121+
used as the value instead. The previous example could also be written as:
116122

117123
```php
118124
<?php
@@ -225,34 +231,36 @@ array, the encoder makes the following decisions:
225231
* Only arrays that have keys from 0 to n-1 in that order are encoded as JSON
226232
arrays. All other arrays are encoded as objects.
227233
* Any object is encoded as a JSON array if the key of the first value
228-
returned by iterating over the objects equals to `0`. All other objects are
234+
returned by iterating over the object equals to `0`. All other objects are
229235
encoded as JSON objects.
230236

231237
Additionally, prior to the decision whether to encode an object as an array or
232-
an object is made, the encoder will attempt to resolve the value as follows:
238+
as an object is made, the encoder will attempt to resolve the value as follows:
233239

234-
* As long as the processed value is a `JsonSerializable`, it will replace the
235-
processed value with the return value of the `jsonSerialize()` method.
240+
* As long as the processed value is a `JsonSerializable`, the encoder will
241+
replace the processed value with the return value of the `jsonSerialize()`
242+
method.
236243
* As long as the processed value is a `Closure`, it will be replaced with the
237-
value returned by invoking the closure in question.
244+
value returned by invoking the closure.
238245

239-
Note that it's possible to override the array or object decision by using the
240-
`JSON_FORCE_OBJECT` option.
246+
Note that it's possible to override the decision between an array or an object
247+
by using the `JSON_FORCE_OBJECT` option, which will force all objects and arrays
248+
to be encoded as JSON objects.
241249

242250
### JSON encoding options ###
243251

244252
Both `BufferJsonEncoder` and `StreamJsonEncoder` have a method `setOptions()` to
245253
change the JSON encoding options. The accepted options are the same as those
246254
accepted by `json_encode()` function. The encoder still internally uses the
247-
`json_encode()` method to encode other values than arrays or object. A few
255+
`json_encode()` method to encode values other than arrays or object. A few
248256
options also have additional effects on the encoders:
249257

250-
* Using `JSON_FORCE_OBJECT` will force all arrays and values to be encoded
258+
* Using `JSON_FORCE_OBJECT` will force all arrays and objects to be encoded
251259
as JSON objects similar to `json_encode()`.
252-
* Using `JSON_PRETTY_PRINT` causes the encoder to output whitespace to make
253-
a more readable output. The indentation used can be changed using the
254-
method `setIndent()` which accepts either a string argument to use as the
255-
indent or an integer to indicate the number of spaces.
260+
* Using `JSON_PRETTY_PRINT` causes the encoder to output whitespace to in
261+
order to make the output more readable. The used indentation can be changed
262+
using the method `setIndent()` which accepts either a string argument to use
263+
as the indent or an integer to indicate the number of spaces.
256264
* Using `JSON_PARTIAL_OUTPUT_ON_ERROR` will cause the encoder to continue the
257265
output despite encoding errors. Otherwise the encoding will halt and the
258266
encoder will throw an `EncodingException`.

0 commit comments

Comments
 (0)