PHPackages                             studiow/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. studiow/table

ActiveLibrary

studiow/table
=============

A helper package for generating HTML tables

v0.1.0(10y ago)1201MITPHPPHP &gt;=5.4.0

Since Aug 3Pushed 9y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Table
=====

[](#table)

A helper package for generating HTML tables

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

```
//Create a table
$table = new \Studiow\Table\Table(["class" => "widefat"]);

//Create some columns
$table->createColumn("post_id", "ID", function($post) {
            return $post->ID;
        })
        ->createColumn("post_title", "Title", function($post) {
            return $post->post_title;
        });
//Add a row, which be just about anything. Probably most of the time it will be an array or an object
$table->addRow($post);

//Add multiple rows at the same time using an array of rows
$table->addRows($posts);

//render the table
echo (string) $table;
```

### Columns

[](#columns)

Defining columns is where most of the fun happens. Most of the time you can use the factory method

```
$table->createColumn("post_title", "Title", function($post) {
            return $post->post_title;
        });
```

is a shorthand for

```
$table->addColumn(new \Studiow\Table\Column\DefaultColumn("post_title", "Title", function($post) {
    return $post->post_title;
}));
```

You can use your own special column types by implementing the \\Studiow\\Table\\ColumnInterface interface.

### Column handlers

[](#column-handlers)

Column handlers can be either a string or a callable. When the handler is a callable, the value will be the result of the callback applied to the rowdata

When the handler is a string, the script will try to find a value. Consider this example:

```
$table->addColumn(new \Studiow\Table\Column\DefaultColumn("post_title", "Title", 'post_title'));
```

When calculating the value we'll check first to see if $rowData is an array or arrayObject. If this is the case, well try to find $rowData\['post\_title\]. If $rowData is an object, we'll check if $rowData has a public property called $post\_data. Finally we'll try and call a method called getPostTitle on $rowData to get the value

Known Issues and todo's
-----------------------

[](#known-issues-and-todos)

### Todo: provide better documentation and tests

[](#todo-provide-better-documentation-and-tests)

There are a lot of possibilities with the package which are not documented and tested enough at the moment, will need a lot more examples

### Todo: support colgroup, tfoot etc.

[](#todo-support-colgroup-tfoot-etc)

### Todo: render to template engine(s)

[](#todo-render-to-template-engines)

Provide a way to extract the data from the table so that a template system can use it

### Standard warning about rendering HTML

[](#standard-warning-about-rendering-html)

If you find yourself rendering large pieces of HTML within a PHP script, you'd probably be better of using a template system.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

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

3939d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b57a4311f92e06e73f6c646344a069d0088747f22e420a583f91bd3e6ab1729?d=identicon)[studiowbe](/maintainers/studiowbe)

---

Top Contributors

[![willemwollebrants](https://avatars.githubusercontent.com/u/916958?v=4)](https://github.com/willemwollebrants "willemwollebrants (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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