1. Go to this page and download the library: Download icmbio/json2html 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/ */
icmbio / json2html example snippets
use Icmbio\Json2html\RenderTable;
$data = [
"name" => "json2html",
"description" => "Converts JSON to HTML"
];
$table = new RenderTable($data);
echo $table->render();
use Icmbio\Json2html\TableVerticalSeparate;
$table = TableVerticalSeparate::make($data)->render();
// Adicionar classe única
$table = (new RenderTable($data))
->tableClass('table table-bordered')
->render();
// Adicionar múltiplas classes via chaining
$table = (new RenderTable($data))
->tableClass('table')
->tableClass('table-bordered')
->tableClass('table-hover')
->render();
$table = (new RenderTable($data))
->tableId('info-table')
->render();
$table = (new RenderTable($data))
->tableBorder(1)
->render();
$table = (new RenderTable($data))
->tableAttribute('data-test', 'custom')
->render();
$data = [
"usuarios" => [
["nome" => "João", "email" => "[email protected]"],
["nome" => "Maria", "email" => "[email protected]"]
]
];
$table = (new RenderTable($data))
->tableId('usuarios-table', nested: false) // ID só na raiz
->tableClass('table', nested: true) // Classe em todas
->tableClass('table-bordered', nested: false) // Classe só na raiz
->tableBorder(1, nested: true) // Border em todas
->tableAttribute('data-module', 'users', nested: false) // Atributo só na raiz
->render();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.