PHPackages                             edtau/ctable - 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. edtau/ctable

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

edtau/ctable
============

Classes for HTML Tables

016PHP

Since Nov 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/edtau/ctable)[ Packagist](https://packagist.org/packages/edtau/ctable)[ RSS](/packages/edtau-ctable/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

CTable simple PHP class to render HTML tables from array
========================================================

[](#ctable-simple-php-class-to-render-html-tables-from-array)

[![Latest Stable Version](https://camo.githubusercontent.com/16894ac439eae0043341c694f28e60cead24e99d657f930f980c2ece6e199f55/68747470733a2f2f706f7365722e707567782e6f72672f6c656170686c792f636172742d62756e646c652f76657273696f6e2e706e67)](https://packagist.org/packages/edtau/ctable)

By Eddie Taube ()

CTable is intended to be used with Anax-MVC () but can also easy be used for a custom PHP application.

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

[](#installation)

To install the package you can use composer

```
composer require edtau/ctable
```

, download the zipfile or clone it through github. For use with ANAX-MVC it is recommended that you copy the Table folder from src to app src. In the folder you find two classes CTable.php and TableController.php. if you want to test CTable copy the file table.php from the package folder webroot then simple run table.php from your application to test the different tables.Installation
------------

[](#installation-1)

If you want to use the package in your own custom application there is a couple of things you have to do for the class to work.

1. Remove from CTable: ```
    implements \Anax\DI\IInjectionAware
    ```
2. And remove the code from CTable:

 ```
use \Anax\DI\TInjectable;
```

3. Now the class should work in your custom project.

Usage
-----

[](#usage)

You have two different options when you want to generate a html-table.

1. First option

```
  $table = new CTable();
  $data = array(
           array('Förnamn', 'Efternamn', 'Ålder'),
           array('Anders', 'Andersson', '40'),
           array('Stig', 'Larsson', '41'),
           array('Anna', 'Svensson', '45')
       );
  $html = $table->table($data);
```

$html now cointains your generated table the first array automatic becomes the headers of your table. You can also set the id by sending the param to your table when getting the html.

$html = $table-&gt;table($data,$myId);

2. Second option set the header for a custom table

 ```
$this->table->setHeader(array('Förnamn', 'Efternamn', 'Ålder'));
       $array = array(
           array('Anders', 'Andersson', '40'),
           array('Stig', 'Larsson', '41'),
           array('Anna', 'Svensson', '45'),
           array('Bengt', 'Andersson', '40'),
           array('Karin', 'Larsson', '41'),
           array('Ulf', 'Svensson', '45')
       );
       $html = $this->table->table($array);
```

The code will generate a table based on your header of course you still have the option to send param id to the table method.

License
-------

[](#license)

This software is free software and carries a MIT license.

Todo
----

[](#todo)

- Add support for CSS classes
- Add support for striped tables

History
-------

[](#history)

v1.0\* (2015-11-10)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7548575?v=4)[Eddie Taube](/maintainers/edtau)[@edtau](https://github.com/edtau)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/edtau-ctable/health.svg)

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

###  Alternatives

[vmwarephp/vmwarephp

Vmware vSphere bindings for PHP

7518.8k](/packages/vmwarephp-vmwarephp)

PHPackages © 2026

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