The Table
element accepts two params, the first one is an assoc array describing the columns and their alignments, the second params is an array of TableRow
elements which will be rendered accordantly.
use BinaryTorch\PhpDown\Table;
use BinaryTorch\PhpDown\TableRow;
$table = Table::make([
'id' => 'center',
'name' => 'left',
'age' => 'right',
], [
TableRow::make(['1', 'saleem', '25']),
]);
echo $table->render();
Output:
| id | name | age |
| :-: | :- | -: |
| 1 | saleem | 25 |