PHP code example of riculum / php-datatables

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

    

riculum / php-datatables example snippets




use Database\Core\Database as DB;

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

$table = "user";
$columns = ["id", "firstname", "lastname", "company", "address", "city", "email", "phone"];

echo Datatable::getDatatable($table, $columns);

$table = "user JOIN city ON user.zip = city.zip";
$columns = ["user.id", "firstname", "lastname", "company", "address", "city.name", "email", "phone"];

echo Datatable::getDatatable($table, $columns);

$table = "user";
$columns = ["id", "firstname", "lastname", "company", "address", "city", "email", "phone"];

$where =     [
    'key' => 'id',
    'operator' => '=',
    'value' => 1
];

echo Datatable::getDatatable($table, $columns, $where);
bash
composer