PHP code example of air-petr / php-tabulator

1. Go to this page and download the library: Download air-petr/php-tabulator 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/ */

    

air-petr / php-tabulator example snippets


use AirPetr\Tabulator;

$body = [
    [1, 'Lila', 'Hevner'],
    [2, 'Florrie', 'Gravie'],
];

$header = ['id', 'first_name', 'last_name'];

echo Tabulator::getPlain($body); // Table without headers
echo Tabulator::getPlain($body, $header); // Table with headers

echo Tabulator::getPlain($data, $headers);

/*
id first_name last_name
 1 Lila       Hevner   
 2 Florrie    Gravie   
*/

echo Tabulator::getSimple($data, $headers);

/*
id first_name last_name
-- ---------- ---------
 1 Lila       Hevner   
 2 Florrie    Gravie   
*/

echo Tabulator::getGitHub($data, $headers);

/*
| id | first_name | last_name |
| -- | ---------- | --------- |
|  1 | Lila       | Hevner    |
|  2 | Florrie    | Gravie    |
*/
shell
php demo/plain.php
php demo/github.php
# etc.