PHP Classes

Eazy PHP HTML Table Generator: Output HTML to display tables from array data

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 121 All time: 9,492 This week: 71Up
Version License PHP version Categories
eazy-table 1.0MIT/X Consortium ...5HTML, PHP 5
Description 

Author

This class can output HTML to display tables from array data.

It takes two arrays as parameters to define the data contents of a table and table tag attributes, the header rows, and the data cells.

The class can generate HTML to display that parameter data in a table.

Picture of Nahid Bin Azhar
  Performance   Level  
Name: Nahid Bin Azhar <contact>
Classes: 24 packages by
Country: United States United States
Age: 33
All time rank: 792109 in United States United States
Week rank: 44 Up6 in United States United States Up
Innovation award
Innovation award
Nominee: 6x

Winner: 2x

Example

<html>
<head>
    <title>Eazy Table Example</title>
</head>
<body>
<?php

require_once 'table.php';

$tbl=new Table;


$table=[
   
'header'=>['ID', 'Name', 'Department'],
   
'data'=>[
        [
2, 'Nahid', 'CSE'],
        [
3, 'Firoz', 'CSE'],
        [
4, 'Jannat', 'BBA'],
        [
5, 'Bijoy', 'CSE']
    ]
];





$tbl->make($table, ['border'=>1,'width'=>200]);

?>
</body>
</html>


Details

eazy-table

A PHP library for making a table

How to use

Eazy Table is too easy to use. Its a basic PHP table maker library.

to use it at first you have to include table.php file in your desire place

require_once 'table.php';

after including the file you have to initialize the class

$tbl=new Table;

Then you are ready to use it.

For making html table you have to use make() method

> make($data[, $config]) >

- $data - is an array. and it contain two values header and data. header and data are the key of the values. Its fixed naming so you can not change the key name. - $config - is an array and its optional. If you want to change table attribute then you can define from it.

Now We define all data to the $data variable

$data=[
'header'=>['ID', 'Name', 'Department'],
'data'=>[
	[2, 'Nahid', 'CSE'],
	[3, 'Firoz', 'CSE'],
	[4, 'Jannat', 'BBA'],
	[5, 'Bijoy', 'CSE']
]];

and for the change table attributes we assign values in $conf array

$conf=['border'=>1,'width'=>200];

and finally we make the table by using

$tbl->make($data, $conf);

after using it, its look like this

enter image description here

thats it

Thank you :)


  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Plain text file table.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:121
This week:0
All time:9,492
This week:71Up