Skip to content

Commit 3f72122

Browse files
committed
Update documentation
1 parent 5aa8bc3 commit 3f72122

File tree

8 files changed

+34
-30
lines changed

8 files changed

+34
-30
lines changed

README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,47 @@ The API documentation is available at: http://violet.riimu.net/api/streaming-jso
2828

2929
## Requirements ##
3030

31-
In order to use this library, the following requirements must be met:
32-
33-
* PHP version 5.6, 7.0 or later
34-
* The PHP library `psr/http-message` must be available
31+
* The minimum supported PHP version is 5.6
32+
* The library depends on the following external PHP libraries:
33+
* [psr/http-message](https://packagist.org/packages/psr/http-message) (`^1.0`)
3534

3635
## Installation ##
3736

37+
### Installation with Composer ###
38+
3839
The easiest way to install this library is to use Composer to handle your
3940
dependencies. In order to install this library via Composer, simply follow
40-
the following two steps:
41+
these two steps:
4142

42-
1. Acquire the `composer.phar` by running the Composer [Command-line
43-
installation script](https://getcomposer.org/download/) in your project
44-
root.
45-
2. Once you've run the installation script, you should have a `composer.phar`
43+
1. Acquire the `composer.phar` by running the Composer
44+
[Command-line installation script](https://getcomposer.org/download/)
45+
in your project root.
46+
47+
2. Once you have run the installation script, you should have the `composer.phar`
4648
file in you project root and you can run the following command:
47-
49+
4850
```
49-
php composer.phar require "violet/streaming-json-encoder:^1.0"
51+
php composer.phar require "violet/streaming-json-encoder:^1.1"
5052
```
53+
54+
After installing this library via Composer, you can load the library by
55+
including the `vendor/autoload.php` file that was generated by Composer during
56+
the installation.
57+
58+
### Adding the library as a dependency ###
5159
52-
If you are already familiar with how to use Composer, you may also alternatively
53-
simply add the library as a dependency by adding the following `composer.json`
54-
file to your project and running the `composer install` command:
60+
If you are already familiar with how to use Composer, you may alternatively add
61+
the library as a dependency by adding the following `composer.json` file to your
62+
project and running the `composer install` command:
5563
5664
```json
5765
{
5866
"require": {
59-
"violet/streaming-json-encoder": "^1.0"
67+
"violet/streaming-json-encoder": "^1.1"
6068
}
6169
}
6270
```
6371

64-
After installing this library via Composer, you can load the library by
65-
including the `vendor/autoload.php` file that was generated by Composer during
66-
the installation.
67-
6872
### Manual installation ###
6973

7074
If you do not wish to use Composer to load the library, you may also download
@@ -73,8 +77,8 @@ and extracting the `src` folder to your project. You may then include the
7377
provided `src/autoload.php` file to load the library classes.
7478

7579
Please note that using Composer will also automatically download the other
76-
required PHP libraries. If you install this library manually, you will need to
77-
also make those other required libraries available.
80+
required PHP libraries. If you install this library manually, you will also need
81+
to make those other required libraries available.
7882

7983
## Usage ##
8084

@@ -171,7 +175,7 @@ write the JSON to file in a streaming manner. For example:
171175

172176
require 'vendor/autoload.php';
173177

174-
$fp = fopen('test.json', 'w');
178+
$fp = fopen('test.json', 'wb');
175179
$encoder = new \Violet\StreamingJsonEncoder\StreamJsonEncoder(
176180
range(1, 100),
177181
function ($json) use ($fp) {

examples/benchmark.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require __DIR__ . '/../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
ini_set('memory_limit', '2048M');
66

examples/buffer_foreach.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
$encoder = new \Violet\StreamingJsonEncoder\BufferJsonEncoder(range(0, 10));
66

examples/buffer_generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
$encoder = new \Violet\StreamingJsonEncoder\BufferJsonEncoder(function () {
66
for ($i = 0; $i <= 10; $i++) {

examples/buffer_simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
$encoder = new \Violet\StreamingJsonEncoder\BufferJsonEncoder(['array_value']);
66
echo $encoder->encode();

examples/json_stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
$iterator = function () {
66
foreach (new DirectoryIterator(__DIR__) as $file) {

examples/stream_file.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

5-
$fp = fopen('test.json', 'w');
5+
$fp = fopen('test.json', 'wb');
66
$encoder = new \Violet\StreamingJsonEncoder\StreamJsonEncoder(
77
range(1, 100),
88
function ($json) use ($fp) {

examples/stream_simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require '../vendor/autoload.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
$encoder = new \Violet\StreamingJsonEncoder\StreamJsonEncoder(['array_value']);
66
$encoder->encode();

0 commit comments

Comments
 (0)