PHP code example of andydune / html-table

1. Go to this page and download the library: Download andydune/html-table 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/ */

    

andydune / html-table example snippets


<table class="table authlog">
    <thead>
    <tr>
        <td>ID</td>
        <td>User</td>
        <td>STATUS</td>
        <td>Created</td>
        <td>Updated</td>
        <td>Uploaded</td>
        <td>Link</td>
        <td>Data</td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    </thead>
    <tbody>
     foreach ($list as $file) {
        

use AndyDune\HtmlTable\Builder;
use AndyDune\HtmlTable\Table;

$table = new Table();
$head = $table->head();
$head->cell()->setContent('ID');
$head->cell()->setContent('User');
$head->cell()->setContent('STATUS');
$head->cell()->setContent('Created');
$head->cell()->setContent('Updated');
$head->cell()->setContent('Uploaded');
$head->cell()->setContent('Uploaded');
$head->cell()->setContent('Data');
// Empty cells will be added automatically depends on max cell count for next rows.
foreach ($list as $file) {
    $row = $table->row();
    if ($file->getStatus() == 2) {
        $row->addClass('table-success')
    }
    $row->cell()->setContent($file->getId());
    $row->cell()->setContent($user['EMAIL'] . $user['XML_ID']);
    $row->cell()->setContent($showStatus($file->getStatus()));
    $row->cell()->setContent($file->getData('DATETIME'));
    $row->cell()->setContent($file->getData('DATETIME_UPDATE'));
    $row->cell()->setContent($file->getData('DATETIME_LAST_REQUEST'));
    $row->cell()->setContent($file->getFileName() . '.' . $file->getFileType());
    $row->cell()->setContent($showArray($file->getMeta()));
}

$buider = new Builder($table);
$builder->setGroupingSections(true);
echo $buider->getHtml(); 

use AndyDune\HtmlTable\Table;

// Set classes *useful* and  *one* to table.
$table = new Table();
$table->addClass('useful')->addClass('one');
$table->getClasses(); ['useful', 'one]
// <table class="useful one">

// Set class *active* to row.
$row = $table->row();
$row->addClass('active');
// <tr class="active">

// Set class *left* to cell.
$cell = $row->cell();
$row->addClass('left');
// <td class="left">

use AndyDune\HtmlTable\Table;

// <table id="top">
$table = new Table();
$table->setId('top');
$table->getId(); // top

// <tr id="active">
$row = $table->row();
$row->setId('active');
$row->getId(); // active

// <td id="left">
$cell = $row->cell();
$row->setId('left');
$row->getId(); //left

php composer.phar update