PHP code example of juniorpaiva / tablebuilder

1. Go to this page and download the library: Download juniorpaiva/tablebuilder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juniorpaiva / tablebuilder example snippets




use ConstructTable\Table;
use ConstructTable\TextColumn;
use ConstructTable\BadgeColumn;

$data = [
    ['title' => 'Produto 1', 'status' => 'pendente', 'created_at' => '2024-03-20'],
    ['title' => 'Produto 2', 'status' => 'concluído', 'created_at' => '2024-03-19'],
];

$table = Table::make()->columns([
    TextColumn::make('title')->sortable()->searchable(),
    BadgeColumn::make('status')->colors(['pendente' => 'red', 'concluído' => 'green']),
    TextColumn::make('created_at'),
])->data($data);

echo $table->render();