Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmudur Rahman committed Jan 3, 2020
1 parent 97b1d58 commit b6e9337
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Let's assume we have a csv file like this.
use Mahmud\Sheet\SheetReader;

SheetReader::makeFromCsv('/path-to-csv-file/example-file.csv')
->delimiter(",") // Optional: You can set delimiter for CSV file
->ignoreRow(0) // Optional: Skip the header row
->columns(['id', 'name', 'age']) // Arbitary column name that will be mapped sequentially for each row
->onEachRow(function($row, $index){
Expand All @@ -51,6 +52,7 @@ You can modify data of each row with middleware. See the following example
use Mahmud\Sheet\SheetReader;

SheetReader::makeFromCsv('/path-to-csv-file/example-file.csv')
->delimiter(",")
->ignoreRow(0)
->columns(['id', 'name', 'age'])
->applyMiddleware(function($row, $index){
Expand All @@ -76,6 +78,7 @@ class AgeMiddleware{
}

SheetReader::makeFromCsv('/path-to-csv-file/example-file.csv')
->delimiter(",")
->ignoreRow(0)
->columns(['id', 'name', 'age'])
->applyMiddleware(new AgeMiddleware)
Expand All @@ -89,6 +92,7 @@ Also you can pass array of middlewares

```php
SheetReader::makeFromCsv('/path-to-csv-file/example-file.csv')
->delimiter(",")
->ignoreRow(0)
->columns(['id', 'name', 'age'])
->applyMiddleware([
Expand All @@ -104,6 +108,7 @@ If you return `null` from middleware, That row will be skipped and won't pass to

```php
SheetReader::makeFromCsv('/path-to-csv-file/example-file.csv')
->delimiter(",")
->ignoreRow(0)
->columns(['id', 'name', 'age'])
->applyMiddleware(function($row){
Expand Down

0 comments on commit b6e9337

Please sign in to comment.