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

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

cyril-verloop/datatables
========================

A library to use DataTables with PHP 8.1+.

4.0.0(3y ago)2424↓50%MITPHPPHP &gt;=8.1CI passing

Since Feb 4Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cyrilverloop/datatables)[ Packagist](https://packagist.org/packages/cyril-verloop/datatables)[ GitHub Sponsors](https://github.com/cyrilverloop)[ RSS](/packages/cyril-verloop-datatables/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

DataTables
==========

[](#datatables)

Simple PHP classes to map DataTables Request and Reponse requiring PHP 8.1+.

**For compatibility with PHP 8.0 see version 3.**

[![License](https://camo.githubusercontent.com/a673a31cb0f5f4a28e30a0f37c7050b68a09a5dea08247f6d215e01a2a2e60a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f637972696c7665726c6f6f702f646174617461626c6573)](https://github.com/cyrilverloop/datatables/blob/trunk/LICENSE)[![Type coverage](https://camo.githubusercontent.com/60f51ffa0e40dbaddd25dd5e52a3799819b49b542efaf20a479dab1b145c78bf/68747470733a2f2f73686570686572642e6465762f6769746875622f637972696c7665726c6f6f702f646174617461626c65732f636f7665726167652e737667)](https://shepherd.dev/github/cyrilverloop/datatables)[![Minimum PHP version](https://camo.githubusercontent.com/4adbef801c5fb4288cd59cf688dd385ab0b893c7a83696e771a8cbc7c0ad4dab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d2532333737374242343f6c6f676f3d706870267374796c653d666c6174)](https://www.php.net/)

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

[](#installation)

### As a Composer depedency

[](#as-a-composer-depedency)

In your project directory run

```
user@host project$ composer require "cyril-verloop/datatables"
```

### For development purposes

[](#for-development-purposes)

```
user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/
user@host projects$ git clone https://github.com/cyrilverloop/datatables.git
user@host projects$ cd datatables
user@host datatables$ composer install -o
user@host datatables$ phive install --trust-gpg-keys 4AA394086372C20A,99BF4D9A33D65E1E,31C7E470E2138192,8AC0BAA79732DD42,C5095986493B4AA0
```

Usage
-----

[](#usage)

You can put the elements requested by DataTables into a "Request" object.

```
use CyrilVerloop\Datatables\Request;

$request = new Request(
    $columns,
    $order,
    $start,
    $length,
    $search
);
```

Then use the "getCriterias" and "getOrderBy" methods to get parameters for a database query.

```
$criterias = $request->getCriterias();
$orderBy = $request->getOrderBy();
```

Once you have the requested records from the database, you can put them into a "Response" object and send the object back to the browser thanks to the "jsonSerialize" method.

```
use CyrilVerloop\Datatables\Response;

$response = new Response($draw, $data, $recordsTotal, $recordsFiltered);
```

Continuous integration
----------------------

[](#continuous-integration)

### Tests

[](#tests)

To run the tests :

```
user@host datatables$ ./tools/phpunit -c ./ci/phpunit.xml
```

The generated outputs will be in `./ci/phpunit/`. Look at `./ci/phpunit/html/index.html` for code coverage and `./ci/phpunit/testdox.html` for a verbose list of passing / failing tests.

To run mutation testing, you must run PHPUnit first, then :

```
user@host datatables$ ./tools/infection -c./ci/infection.json
```

The generated outputs will be in `./ci/infection/`.

### Static analysis

[](#static-analysis)

To do a static analysis :

```
user@host datatables$ ./tools/psalm -c ./ci/psalm.xml [--report=./psalm/psalm.txt --output-format=text]
```

Use "--report=./psalm/psalm.txt --output-format=text" if you want the output in a file instead of on screen.

### PHPDoc

[](#phpdoc)

To generate the PHPDoc :

```
user@host datatables$ ./tools/phpdocumentor --config ./ci/phpdoc.xml
```

The generated HTML documentation will be in `./ci/phpdoc/`.

### Standard

[](#standard)

All PHP files in this project follows [PSR-12](https://www.php-fig.org/psr/psr-12/). To indent the code :

```
user@host datatables$ ./tools/phpcbf --standard=PSR12 --extensions=php -p ./src/ ./tests/
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance58

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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

Every ~93 days

Recently: every ~107 days

Total

8

Last Release

1270d ago

Major Versions

1.0.0 → 2.0.02021-02-22

2.0.2 → 3.0.02022-01-27

3.1.0 → 4.0.02022-11-25

PHP version history (3 changes)1.0.0PHP &gt;=7.4

3.0.0PHP &gt;=8.0

4.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/322b031f8ce9fdaf307dc75cc45a33dd2d7ea8e5c75c4e5fc7e5507ccab294f7?d=identicon)[cyrilverloop](/maintainers/cyrilverloop)

---

Top Contributors

[![cyrilverloop](https://avatars.githubusercontent.com/u/37014314?v=4)](https://github.com/cyrilverloop "cyrilverloop (306 commits)")

### Embed Badge

![Health badge](/badges/cyril-verloop-datatables/health.svg)

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

PHPackages © 2026

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