PHPackages                             limu/ctablehelper - 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. limu/ctablehelper

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

limu/ctablehelper
=================

PHP class for creating tables from arrays (html helper)

v1.0(10y ago)019MITHTMLPHP &gt;=5.4

Since Oct 7Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ceb75afbfb65843ed9c91cadbec4aec44b59c7c8e6f68c4e9bc58caab56bc93d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d756a616e682f637461626c6568656c7065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Mujanh/ctablehelper/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/19a042deb87fc0052599db3ee1b11f0647adc87c4c33ac4c11bb82a45f101aef/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d756a616e682f637461626c6568656c7065722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Mujanh/ctablehelper/?branch=master)[![Build Status](https://camo.githubusercontent.com/885865e28dcb82cf566e046a80b3763ad7901d23bc43862f7a1024d299d4f1bd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d756a616e682f637461626c6568656c7065722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Mujanh/ctablehelper/build-status/master)\#CTableHelper

CTableHelper is a HTML Helper that helps you create HTML tables. It is written in PHP and is meant to be used with Anax-MVC.

\##Installation You can install the class `CTableHelper` with Composer and Packagist by adding the the ctablehelper package to your composer.json file in your Anax-MVC:

```
"require": {
    "php": ">=5.4",
    "limu/ctablehelper": "dev-master"
},

```

\##Setup

\###Example file In the webroot folder of ctablehelper, you will find an example file named `TableExample.php`. Move this file into your webroot folder of your Anax-MVC. It is a simple page controller for Anax-MVC and contains examples of html tables the module can create.

\###CSS file Move `ctablehelper.css` from the ctablehelper/webroot/css folder to your css-folder in your Anax-MVC webroot (Anax-MVC/webroot/css). This is an optional step, but neccessary if you wish to use any of the premade table stylings.

\##Usage

\###Get Started To include the class `CTableHelper.php` in your Anax-MVC project, use `$di->set()`:

\####In page controller

```
$di->set('table', '\Limu\HTMLTable\CTableHelper');

```

\####In class/controller

```
$this->di->set('table', '\Anax\HTMLTable\CTableHelper');

```

\###Create a table To create a new HTML Table you will use the method `createTable($headers, $data, $style = '')`. The array `$headers` are the table headers you wish to use. The multidimensional array (or object) `$data` contains the data that goes into the table cells. Each inner array represents one row in the table. The optional string `$style` is which class name (and thus which styling) you wish to assign to the HTML table.

\####Example (from `TableExample.php`)

```
$tableHeaders = ['My header', 'Another header', 'Last header'];

$cellData = [
    ['data row 1 cell 1', 'data row 1 cell 2', 'data row 1 cell 3'],
    ['data row 2 cell 1', 'data row 2 cell 2', 'data row 2 cell 3'],
    ['data row 3 cell 1', 'data row 3 cell 2', 'data row 3 cell 3'],
    ['data row 4 cell 1', 'data row 4 cell 2', 'data row 4 cell 3'],
];

$app->table->createTable($tableHeaders, $cellData, 'light');

```

\####Note It is possible to use an empty array for `$headers` if you wish to not use any table headers. However, if you choose to use headers, the number of headers must be the same as the number of arrays in `$data`, making the columns and headers match in numbers. Likewise, all rows must contain the same number of cells. If these criterias are not met, the table will not be created but an error message will be produced instead.

\###Styling If you wish to use any of the default stylings, you need to import `ctablehelper.css`to your `style.css` in Anax-MVC or add the module's stylesheet with `$app->theme->addStylesheet('css/ctablehelper.css');` in your page controller. Have a look at the `TableExample.php` to see the different styling options available, but please remember that you will only see the different stylings if you have moved the `ctablehelper.css` to your Anax-MVC css-folder. If you want to use your own styling, simply add a class name of your choice as a third argument to the method `createTable($headers, $data, $style = '')` and style as you like.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3876d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7262e3d503092917b7e2b1d10b8ed06c1d93655a7a7370ac6ea9c4b8daf7339e?d=identicon)[Mujan](/maintainers/Mujan)

---

Top Contributors

[![Mujanh](https://avatars.githubusercontent.com/u/14004851?v=4)](https://github.com/Mujanh "Mujanh (18 commits)")

---

Tags

htmlmoduleeducationtables

### Embed Badge

![Health badge](/badges/limu-ctablehelper/health.svg)

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

###  Alternatives

[mkalkbrenner/php-htmldiff-advanced

An add-on for the php-htmldiff library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

3517.8M1](/packages/mkalkbrenner-php-htmldiff-advanced)[lab1521/neaty-html

Cleans up HTML markup with Tidy

247.2k](/packages/lab1521-neaty-html)[dorsetdigital/silverstripe-enhanced-requirements

Enhanced requirements for Silverstripe

117.8k4](/packages/dorsetdigital-silverstripe-enhanced-requirements)

PHPackages © 2026

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