PHPackages                             jupitern/table - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. jupitern/table

ActiveLibrary[Framework](/categories/framework)

jupitern/table
==============

HTML table generation for PHP. integrates with your favourite orm and js library

2.1.0(3y ago)2614.0k8[1 issues](https://github.com/jupitern/table/issues)MITPHPPHP &gt;=8.0

Since Jan 22Pushed 3y ago4 watchersCompare

[ Source](https://github.com/jupitern/table)[ Packagist](https://packagist.org/packages/jupitern/table)[ Docs](https://github.com/jupitern/table)[ RSS](/packages/jupitern-table/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (20)Used By (0)

[![Build Status](https://camo.githubusercontent.com/952f08d53b79ee263659963c6c443395a22ed7a51390a1582052352b7bf1c67d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a7570697465726e2f7461626c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jupitern/table/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a221bd5b2d2613913d5327a7afbe11352a1653ae3fdfb9f95bf77671f7177c7d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a7570697465726e2f7461626c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jupitern/table/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/248d48063aed232f28a0b15593b68be3e65ed4946924fbe839589746f96db255/68747470733a2f2f706f7365722e707567782e6f72672f6a7570697465726e2f7461626c652f762f737461626c652e737667)](https://packagist.org/packages/jupitern/table) [![Latest Unstable Version](https://camo.githubusercontent.com/fad31af937270d41f7e13cb8c75c459774bd79411c372462c17eb706c45da0af/68747470733a2f2f706f7365722e707567782e6f72672f6a7570697465726e2f7461626c652f762f756e737461626c652e737667)](https://packagist.org/packages/jupitern/table) [![License](https://camo.githubusercontent.com/5f30033927178276747af56175cd1c98254f17d31f9ba4c16c58e358632bc5df/68747470733a2f2f706f7365722e707567782e6f72672f6a7570697465726e2f7461626c652f6c6963656e73652e737667)](https://packagist.org/packages/jupitern/table)

jupitern/table
==============

[](#jupiterntable)

#### HTML table generation with PHP.

[](#html-table-generation-with-php)

Pass your data using:

- JSON, Arrays (associative or not).
- result set using PDO or you favourite framework ORM.
- directly or using ajax requests.
- Integrates easily with your preferred js library.
- more to come...

Demo:
-----

[](#demo)

soon...

Requirements
------------

[](#requirements)

PHP 8.0 or higher.

Installation
------------

[](#installation)

Include jupitern/table in your project, by adding it to your composer.json file.

```
{
    "require": {
        "jupitern/table": "3.*"
    }
}
```

Usage
-----

[](#usage)

```
// instance Table with instance name
\Jupitern\Table\Table::instance()

// set data for non ajax requests
// using a array
->setData([ [1, 'Peter', '35', '961 168 851'], [2, 'John', '44', '169 853 741'] ])
// using a associative array
->setData([
	['id' => 1, 'name' => 'Peter', 'age' => '35', 'phone' => '961 168 851'],
	['id' => 2, 'name' => 'John', 'age' => '44', 'phone' => '169 853 741'],
])
// using json string
->setData([[1,"Peter","35","961 168 851"],[2,"John","44","169 853 741"]])
// using PDO result or your framework ORM. see example how to grab $data at the end
->setData($data)

// add attributes to the  html tag one by one
->attr('table', 'id', 'demoTable')
->attr('table', 'class', 'table table-bordered table-striped table-hover')
->attr('table', 'cellspacing', '0')

// or add all  attributes at once
->attrs('table', ['class' => 'table table-bordered', 'cellspacing' => '0'])

// add attributes to the table rows
->css('tr', 'background-color', 'red')

// add attributes to the table rows using a callable
->attr('tr', 'data-id', function($row) {
    return 'row-' . $row['id'];
})

// add a new column for array data
->column()
	->title('Name')
	->value(1)
->add()

// add a new column for (associative array, PDO or ORM) data
->column()
	->title('Age')
	->value('age')
->add()

// add a column with a closure for value field to process data in execution
// this example assumes data as object
->column()
	->title('Name')
	->value(function ($row) {
		return rand(1,10)%2 ? ''.$row->name.'' : $row->name;
	})
->add()

// another closure example for adding a column with edit action with no title on
// this example assumes data associative array
->column()
	->value(function ($row) {
		return 'edit '.$row['name'].'';
	})
->add()

// add a column with text field as filter
->column()
	->title('Name')
	->value('name')
	->filter()
->add()

// add a column with a drop down field as filter
// $filterData as array
->column()
	->title('Name')
	->value('name')
	->filter([[1, 'Peter'], [2, 'John']])
->add()

// add a column with a drop down field as filter
// $filterData from (associtive array, PDO or ORM). see example how to grab $data at the end
->column()
	->title('Name')
	->value('name')
	->filter($filterData)
->add()

// add a column with some attributes and css for  and
->column()
	->title('Name')
	->value('name')
	->attr('th', 'data-val', 'foo')		        // add attributes to
    ->css('th', 'background-color', '#f5f5f5')	// add css to
    ->attr('td', 'data-val', 'bar')				// add attributes to
    ->css('td', 'background-color', '#f5f5f5')	// add css to
->add()

// echo table output
->render();

// OR return table output
->render(true);
```

Example using PDO and datatables
--------------------------------

[](#example-using-pdo-and-datatables)

```
// grab data from db with PDO or in alternative from your framework ORM
$db = new PDO('mysql:host=HOST_NAME;dbname=DB_NAME;charset=utf8', 'DB_USERNAME', 'DB_PASSWORD',
		array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
);
// data to populate table
$data = $db->query("SELECT id, name, age, phone FROM persons")->fetchAll(PDO::FETCH_OBJ);
// used for column filter
$filterData = $db->query("SELECT name as val, name FROM persons limit 10")->fetchAll(PDO::FETCH_OBJ);

\Jupitern\Table\Table::instance()
	->setData($data)
	->attr('table', 'id', 'demoTable')
	->attr('table', 'class', 'table table-bordered table-striped table-hover')
	->attr('table', 'cellspacing', '0')
	->attr('table', 'width', '100%')
	->column()
		->title('Name')
		->value(function ($row) {
			return rand(1,10)%2 ? ''.$row->name.'' : $row->name;
		})
		->filter($filterData)
		->css('td', 'color', 'green')
		->css('td', 'width', '50%')
		->css('td', 'background-color', '#ccc', true)
	->add()
	->column()
		->title('Age')
		->value('age')
		->filter()
		->css('td', 'color', 'red')
		->css('td', 'width', '20%')
	->add()
	->column()
	    ->title('Phone')
		->filter()
		->value('phone')
		->css('td', 'color', 'red')
		->css('td', 'width', '20%')
	->add()
	->column()
		->value(function ($row) {
			return 'edit';
		})
		->css('td', 'width', '10%')
	->add()
	->render();
?>

Include Jquery, Datatables and Bootstrap (optional) in your html.

    $(document).ready( function () {
        $('#demoTable').DataTable();
    });

```

Roadmap
-------

[](#roadmap)

- add demo and more examples
- code some tests

Contributing
------------

[](#contributing)

- welcome to discuss a bugs, features and ideas.

License
-------

[](#license)

jupitern/table is release under the MIT license.

You are free to use, modify and distribute this software, as long as the copyright header is left intact

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~159 days

Recently: every ~276 days

Total

18

Last Release

1418d ago

Major Versions

0.5.1 → 1.0.02016-11-17

1.0.3 → 2.0.02019-06-19

PHP version history (4 changes)0.1PHP &gt;=5.3

0.5.0PHP &gt;=5.4

2.0.0PHP &gt;=5.6

2.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8205aca1dd2a7d1f98452950c3754b7430d16bcfe53494bfdf5c20d277d7776c?d=identicon)[jupitern](/maintainers/jupitern)

---

Top Contributors

[![jupitern](https://avatars.githubusercontent.com/u/4422374?v=4)](https://github.com/jupitern "jupitern (11 commits)")[![craigrodway](https://avatars.githubusercontent.com/u/83069?v=4)](https://github.com/craigrodway "craigrodway (3 commits)")

---

Tags

html-tablephpphp-tabletabletable-generatorframeworkuiormjquerydatatablesPHP html table generation

### Embed Badge

![Health badge](/badges/jupitern-table/health.svg)

```
[![Health](https://phpackages.com/badges/jupitern-table/health.svg)](https://phpackages.com/packages/jupitern-table)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
