PHPackages                             hypnokizer/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hypnokizer/table

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hypnokizer/table
================

Class to build HTML tables

v7.0.0(1mo ago)010MITPHPPHP &gt;=8.3.0

Since Jun 4Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Table class
===========

[](#table-class)

This class quickly builds HTML tables with semantic HTML.

Basic Use
---------

[](#basic-use)

Instantiate the object. The only parameter is optional and used to define a class name for the table. Any of the table attributes, including class name, can be defined using the `attr()` method.

```
$t = new table('my class name');
$t->attr('id', 'tableID');

```

The basic methods add a row, cell, or attribute. These define the table which is created when the `createTable()` method is called.

Each new table row must be defined by calling the `row()` method. This method accepts a single parameter of `thead`, `tfoot`, or `tbody`. Leaving it empty will default to `tbody`. Attributes for the current table row can be defined using the `attr()` method.

```
$t->row()->attr('id', 'myRowID')->attr('class', 'myRowClass');

```

Once the table row has been defined, individual cells can be defined. This is done using the `cell()` method. The single parameter takes any string value. The attributes for the cell can be defined using the `attr()` method. Any valid HTML5 attribute can be used, including data attributes.

```
$t->cell('this is cell 1');
$t->cell('this is cell 2');
$t->cell('this is cell 3')->attr('class', 'myCellClass');

```

Once the table has been completely defined, you can call the final method to create the complete string of HTML. This method has one optional parameter. The boolean value of `false` will return a string. The default boolean value of `true`, or omitting the parameter altogether, will echo the HTML string.

```
$t->createTable();

```

Debugging
---------

[](#debugging)

There is one method used for debugging. It displays the entire object and its values.

```
$t->showObject();

```

Complete Example
----------------

[](#complete-example)

The example below shows the most basic usage of this class. Typically, the table body is created by looping through an array of data.

```
$t = new table();

$t->caption('My table caption');

$t->row('thead');
$t->cell('Heading One');
$t->cell('Heading Two');

foreach($databaseresults as $result) {
    $t->row();
    $t->cell($result['cellone'])->attr('class', 'highlightcell');
    $t->cell($result['celltwo]);
}

$t->row('tfoot');
$t->cell('footing one');
$t->cell('footing two');

$t->createTable();

```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3f04fb7f9edd59483cbc169f93b005c9dc3d22d8b3f219f5f789f2ff969a21e?d=identicon)[Hypnokizer](/maintainers/Hypnokizer)

---

Top Contributors

[![Hypnokizer](https://avatars.githubusercontent.com/u/279126957?v=4)](https://github.com/Hypnokizer "Hypnokizer (10 commits)")

### Embed Badge

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

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

PHPackages © 2026

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