PHPackages                             neurosys/doctrine-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. neurosys/doctrine-datatables

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

neurosys/doctrine-datatables
============================

Library providing a Doctrine2 wrapper over Datatables.js

23.0k[2 issues](https://github.com/neurosys-public/doctrine-datatables/issues)[1 PRs](https://github.com/neurosys-public/doctrine-datatables/pulls)PHP

Since Dec 9Pushed 9y ago3 watchersCompare

[ Source](https://github.com/neurosys-public/doctrine-datatables)[ Packagist](https://packagist.org/packages/neurosys/doctrine-datatables)[ RSS](/packages/neurosys-doctrine-datatables/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Doctrine Datatables library [![Build Status](https://camo.githubusercontent.com/5f444cc0b9456d2958159fdbf8959881d9c4598236e9dac0916d97499b563183/68747470733a2f2f7472617669732d63692e6f72672f6e6575726f7379732d706c2f646f637472696e652d646174617461626c65732e706e67)](https://travis-ci.org/neurosys-pl/doctrine-datatables)
============================================================================================================================================================================================================================================================================================================================

[](#doctrine-datatables-library-)

Doctrine Datatables library provides a Doctrine2 server side processing for [Datatables](http://datatables.net/).

This library was created because existing libraries lack of flexibility around field types and field filtering. This library does not provide any JavaScript code generation nor datatables.js sources, you need to install and run datatables.js yourself.

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

[](#installation)

You can install this library using composer

```
composer require neurosys/doctrine-datatables

```

or add the package name to your composer.json

```
"require": {
    ...
    "neurosys/doctrine-datatables": "dev-master"
}
```

Features
--------

[](#features)

- support of doctrine query builder
- support of column search with custom column definitions (ex. number, date, composed fields)

It does not support global search (yet)

Usage
-----

[](#usage)

```
$builder = new TableBuilder($entityManager, $_GET);
$builder
    ->from('Foo\Bar\Entity\Sample', 's')
    ->add('text', 's.name')      // field name will be resolved from request (mDataProp_X)
    ->add('number', 's.price')   // field will be a number field which can be filtered by value range
    ->add('boolean', 's.active')
    ;

$response = $builder->getTable()
    ->getResponseArray('entity') // hydrate entity, defaults to array
    ;

// now you can simply return a response
// header ('Content-Type', 'application/json');
// echo json_encode($response);
```

Composed fields example:

```
$builder
    ->from('Foo\Bar\Entity\Sample', 's')
    ->join('s.user', 'u')
    ->add('text', 's.name')                          // select and filter by a name field
    ->add('text', 'u.firstName, u.lastName', 'u.id') // select firstName and lastName but filter by an id field
    ->add('date')
    ;
```

Custom query builder example:

```
$responseArray = $builder
    ->setQueryBuilder($customQueryBuilder)
    ->add('text', 's.foo', 's.bar') // select foo field but filter by a bar field
    ->getTable()
    ->getResponseArray();
```

Available field types
---------------------

[](#available-field-types)

- text
- number
- date
- boolean
- choice

Twig field rendering
--------------------

[](#twig-field-rendering)

Default renderer is PhpRenderer, this can be changed by passing another renderer as 4th argument to the TableBuilder:

```
new TableBuilder($entityManager, $_GET, null, new TwigRenderer($twigEnvironment));
```

To set field template pass template option:

```
$builder
    ->add('date', 's.createdAt', null, array(
        'template' => 'path/to/template.html.twig'
    ))
```

In template.html.twig

```
{{ value | date }}
```

Warning
-------

[](#warning)

This library is still in development, API is most likely to change.

License
-------

[](#license)

Doctrine Datatables is licensed under the MIT license.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.9% 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/299203?v=4)[neurosys](/maintainers/neurosys)[@neurosys](https://github.com/neurosys)

---

Top Contributors

[![bpasinski-neurosys](https://avatars.githubusercontent.com/u/12530633?v=4)](https://github.com/bpasinski-neurosys "bpasinski-neurosys (35 commits)")[![hellomedia](https://avatars.githubusercontent.com/u/868734?v=4)](https://github.com/hellomedia "hellomedia (6 commits)")[![neurosys-public](https://avatars.githubusercontent.com/u/5764675?v=4)](https://github.com/neurosys-public "neurosys-public (5 commits)")[![lizuk-neurosys](https://avatars.githubusercontent.com/u/9930485?v=4)](https://github.com/lizuk-neurosys "lizuk-neurosys (1 commits)")[![mpruciak-neurosys](https://avatars.githubusercontent.com/u/20660516?v=4)](https://github.com/mpruciak-neurosys "mpruciak-neurosys (1 commits)")

### Embed Badge

![Health badge](/badges/neurosys-doctrine-datatables/health.svg)

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

PHPackages © 2026

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