@@ -11,7 +11,7 @@ such as a list of user records or log entries. CSV is not exactly a new format
1111and has been used in a large number of systems for decades. In particular, CSV
1212is often used for historical reasons and despite its shortcomings, it is still a
1313very common export format for a large number of tools to interface with
14- spreadsheet processors (such as Exel , Calc etc.). This library provides a simple
14+ spreadsheet processors (such as Excel , Calc etc.). This library provides a simple
1515streaming API to process very large CSV files with thousands or even millions of
1616rows efficiently without having to load the whole file into memory at once.
1717
@@ -40,7 +40,7 @@ rows efficiently without having to load the whole file into memory at once.
4040
4141## Support us
4242
43- We invest a lot of time developing, maintaining and updating our awesome
43+ We invest a lot of time developing, maintaining, and updating our awesome
4444open-source projects. You can help us sustain this high-quality of our work by
4545[ becoming a sponsor on GitHub] ( https://github.com/sponsors/clue ) . Sponsors get
4646numerous benefits in return, see our [ sponsoring page] ( https://github.com/sponsors/clue )
@@ -96,9 +96,9 @@ World!"
9696 started using some CSV-variant long before this standard was defined.
9797
9898Some applications refer to CSV as Character-Separated Values, simply because
99- using another delimiter (such as semicolon or tab) is a rather common approach
99+ using another delimiter (such as a semicolon or tab) is a rather common approach
100100to avoid the need to enclose common values in quotes. This is particularly
101- common for systems in Europe (and elsewhere) that use a comma as decimal separator.
101+ common for systems in Europe (and elsewhere) that use a comma as a decimal separator.
102102
103103```
104104name;comment
@@ -115,7 +115,7 @@ consistently.
115115
116116Despite its shortcomings, CSV is widely used and this is unlikely to change any
117117time soon. In particular, CSV is a very common export format for a lot of tools
118- to interface with spreadsheet processors (such as Exel , Calc etc.). This means
118+ to interface with spreadsheet processors (such as Excel , Calc etc.). This means
119119that CSV is often used for historical reasons and using CSV to store structured
120120application data is usually not a good idea nowadays – but exporting to CSV for
121121known applications continues to be a very reasonable approach.
@@ -155,11 +155,11 @@ test,1,24
155155"hello world",2,48
156156```
157157``` php
158- $stdin = new ReadableResourceStream(STDIN);
158+ $stdin = new React\Stream\ ReadableResourceStream(STDIN);
159159
160- $csv = new Decoder($stdin);
160+ $csv = new Clue\React\Csv\ Decoder($stdin);
161161
162- $csv->on('data', function ($data) {
162+ $csv->on('data', function (array $data) {
163163 // $data is a parsed element from the CSV stream
164164 // line 1: $data = array('test', '1', '24');
165165 // line 2: $data = array('hello world', '2', '48');
@@ -179,9 +179,9 @@ use a quote enclosure character (`"`) and a backslash escape character (`\`).
179179This behavior can be controlled through the optional constructor parameters:
180180
181181``` php
182- $csv = new Decoder($stdin, ';');
182+ $csv = new Clue\React\Csv\ Decoder($stdin, ';');
183183
184- $csv->on('data', function ($data) {
184+ $csv->on('data', function (array $data) {
185185 // CSV fields will now be delimited by semicolon
186186});
187187```
@@ -193,7 +193,7 @@ unreasonably long lines. It accepts an additional argument if you want to change
193193this from the default of 64 KiB:
194194
195195``` php
196- $csv = new Decoder($stdin, ',', '"', '\\', 64 * 1024);
196+ $csv = new Clue\React\Csv\ Decoder($stdin, ',', '"', '\\', 64 * 1024);
197197```
198198
199199If the underlying stream emits an ` error ` event or the plain stream contains
@@ -261,11 +261,11 @@ test,1
261261"hello world",2
262262```
263263``` php
264- $stdin = new ReadableResourceStream(STDIN);
264+ $stdin = new React\Stream\ ReadableResourceStream(STDIN);
265265
266- $csv = new AssocDecoder($stdin);
266+ $csv = new Clue\React\Csv\ AssocDecoder($stdin);
267267
268- $csv->on('data', function ($data) {
268+ $csv->on('data', function (array $data) {
269269 // $data is a parsed element from the CSV stream
270270 // line 1: $data = array('name' => 'test', 'id' => '1');
271271 // line 2: $data = array('name' => 'hello world', 'id' => '2');
@@ -312,9 +312,9 @@ and accepts its data through the same interface, but handles any data as complet
312312CSV elements instead of just chunks of strings:
313313
314314``` php
315- $stdout = new WritableResourceStream(STDOUT);
315+ $stdout = new React\Stream\ WritableResourceStream(STDOUT);
316316
317- $csv = new Encoder($stdout);
317+ $csv = new Clue\React\Csv\ Encoder($stdout);
318318
319319$csv->write(array('test', true, 24));
320320$csv->write(array('hello world', 2, 48));
@@ -332,7 +332,7 @@ a Unix-style EOL (`\n` or `LF`).
332332This behavior can be controlled through the optional constructor parameters:
333333
334334``` php
335- $csv = new Encoder($stdout, ';');
335+ $csv = new Clue\React\Csv\ Encoder($stdout, ';');
336336
337337$csv->write(array('hello', 'world'));
338338```
@@ -379,7 +379,7 @@ For more details, see ReactPHP's
379379
380380## Install
381381
382- The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
382+ The recommended way to install this library is [ through Composer] ( https://getcomposer.org/ ) .
383383[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
384384
385385This project follows [ SemVer] ( https://semver.org/ ) .
@@ -394,12 +394,12 @@ See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
394394This project aims to run on any platform and thus does not require any PHP
395395extensions and supports running on legacy PHP 5.3 through current PHP 8+ and
396396HHVM.
397- It's * highly recommended to use the latest supported PHP version PHP 7+ * for this project.
397+ It's * highly recommended to use the latest supported PHP version* for this project.
398398
399399## Tests
400400
401401To run the test suite, you first need to clone this repo and then install all
402- dependencies [ through Composer] ( https://getcomposer.org ) :
402+ dependencies [ through Composer] ( https://getcomposer.org/ ) :
403403
404404``` bash
405405$ composer install
@@ -408,7 +408,7 @@ $ composer install
408408To run the test suite, go to the project root and run:
409409
410410``` bash
411- $ php vendor/bin/phpunit
411+ $ vendor/bin/phpunit
412412```
413413
414414## License
0 commit comments