Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Sep 28, 2023
1 parent 6b08e9e commit 380443c
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,26 @@ $html = <<<HTML
<table>
<caption>Songs</caption>
<thead>
<tr><th>Title</th><th>Singer</th><th>Country</th></tr>
<tr>
<th>Title</th>
<th>Singer</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr><td>Nakei Nairobi</td><td>Mbilia Bel</td><td rowspan="3">DRC Congo</td></tr>
<tr><td>Muvaro</td><td>Zaiko Langa Langa</td></tr>
<tr><td>Nzinzi</td><td>Emeneya</td></tr>
<tr>
<td>Nakei Nairobi</td>
<td>Mbilia Bel</td>
<td rowspan="3">DR Congo</td>
</tr>
<tr>
<td>Muvaro</td>
<td>Zaiko Langa Langa</td>
</tr>
<tr>
<td>Nzinzi</td>
<td>Emeneya</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -259,7 +273,9 @@ HTML;
$table = Parser::new()->parseHtml($html);
$table->getCaption(); //returns 'Songs'
$table->getHeader(); //returns ['Title','Singer', 'Country']
$table->nth(2); //returns ["Title" => "Nzinzi", "Singer" => "Emeneya", "Country" => "DRC Congo"]
$table->nth(2); //returns ["Title" => "Nzinzi", "Singer" => "Emeneya", "Country" => "DR Congo"]
json_encode($table->slice(0, 1));
//{"caption":"Songs","header":["Title","Singer","Country"],"rows":[{"Title":"Nakei Nairobi","Singer":"Mbilia Bel","Country":"DR Congo"}]}
```
## Testing
Expand Down

0 comments on commit 380443c

Please sign in to comment.