PHPackages                             goten4/gtn-datatables - 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. goten4/gtn-datatables

ActiveLibrary

goten4/gtn-datatables
=====================

Zend Framework 2 Module that provides Server Side support for jQuery DataTables

02.3k1PHPCI failing

Since Apr 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/goten4/GtnDataTables)[ Packagist](https://packagist.org/packages/goten4/gtn-datatables)[ RSS](/packages/goten4-gtn-datatables/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Zend Framework 2 Module for jQuery DataTables
=============================================

[](#zend-framework-2-module-for-jquery-datatables)

[![Build Status](https://camo.githubusercontent.com/f4f088e33c976784472f2c192448a2b1c89ae43df39f768dda0ce380b8b59116/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f676f74656e342f47746e446174615461626c65732e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/goten4/GtnDataTables)[![Coverage Status](https://camo.githubusercontent.com/b64a569f2c20b40a84ed9e932800701a5786da2403ed28dcf692ef3e24699cbf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f676f74656e342f47746e446174615461626c65732f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/goten4/GtnDataTables)

Introduction
------------

[](#introduction)

**GtnDataTables** is a Zend Framework 2 module providing basics support for server side [jQuery DataTables](http://datatables.net/).

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

[](#requirements)

- Zend Framework 2

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

[](#installation)

- Add the following line in the require section of your composer.json

    "goten4/gtn-datatables": "dev-master"
- Then run the following command

    php composer.phar update
- Or simply clone this project into your `./vendor/` directory.
- Enable the module in your `./config/application.config.php` file.

Usage
-----

[](#usage)

A good example is worth a thousand words ;)

### Configuration

[](#configuration)

```
'datatables' => array(
    'servers_datatable' => array(
        /**
         * Id attribute of the table HTML element.
         * Optional: if not provided the key of the datatable config is used (servers_datatable here).
         */
        'id' => 'servers',

        /**
         * Class attribute of the table HTML element.
         * Optional.
         */
        'classes' => ['table', 'bootstrap-datatable'],

        /**
         * Must implements Zend\ServiceManager\FactoryInterface.
         * createService method must return GtnDataTables\CollectorInterface.
         * Mandatory.
         */
        'collectorFactory' => 'MyProject\Service\MyCollectorFactory',

        /**
         * List of the columns of the datatable.
         * Mandatory.
         */
        'columns' => [
            [
                /**
                 * Must extend GtnDataTables\View\AbstractDecorator.
                 * Mandatory.
                 */
                'decorator' => 'MyProject\View\MyDecorator',

                /**
                 * Used to identify the column for ordering.
                 * Optionnal (if the column is not orderable).
                 */
                'key' => 'name',
            ]
        ]
    )
)

```

### Collector

[](#collector)

```
class ServersCollector implements CollectorInterface
{
    /**
     * @param array $params
     * @return Collection
     */
    public function findAll(array $params = null)
    {
        // Get the $servers, $total and $filteredCount from database (or any other data source)

        return Collection::factory($servers, $total, $filteredCount);
    }
}

```

### Column Decorator

[](#column-decorator)

```
class ServerNameDecorator extends AbstractDecorator
{
    /**
     * @return string
     */
    public function decorateTitle()
    {
        return $this->getViewHelperManager()->get('translator')->translate('Server');
    }

    /**
     * @param Server $object
     * @return string
     */
    public function decorateValue($object)
    {
        return '' . $object->getName() . '';
    }
}

```

### In the controller

[](#in-the-controller)

```
public function indexAction()
{
    $model = new JsonModel();
    $datatable = $this->getServiceLocator()->get('servers_datatable');
    $result = $datatable->getResult($this->params()->fromQuery());
    $model->setVariable('draw', $result->getDraw());
    $model->setVariable('recordsTotal', $result->getRecordsTotal());
    $model->setVariable('recordsFiltered', $result->getRecordsFiltered());
    $model->setVariable('data', $result->getData());
    return $model;
}

```

### In the view

[](#in-the-view)

```

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

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://www.gravatar.com/avatar/3d77b9f9f50dbb6296a88da050fb9b317f6cbb742a879584d1f0ed363bb960fb?d=identicon)[goten4](/maintainers/goten4)

---

Top Contributors

[![goten4](https://avatars.githubusercontent.com/u/47129?v=4)](https://github.com/goten4 "goten4 (23 commits)")

### Embed Badge

![Health badge](/badges/goten4-gtn-datatables/health.svg)

```
[![Health](https://phpackages.com/badges/goten4-gtn-datatables/health.svg)](https://phpackages.com/packages/goten4-gtn-datatables)
```

PHPackages © 2026

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