Search by

pentiminax / ux-datatables

Pentiminax

DataTables.net integration for Symfony

Package info

github.com/pentiminax/ux-datatables

Type:symfony-bundle

pkg:composer/pentiminax/ux-datatables

Statistics

Installs: 4 561

Dependents: 0

Suggesters: 0

Stars: 12

Open Issues: 7

v1.8.0 2026-11-20 19:51 UTC

README

The easiest way to build DataTables.net tables in Symfony

Latest Stable Version PHP Version Total Downloads Coverage

Documentation β€’ Demo β€’ Video Tutorial

UX DataTables is a Symfony UX bundle that turns a PHP class into a fully featured DataTables.net table: typed columns, Doctrine-backed server-side processing, filters, actions, inline editing, and live updates.

Quick Start

composer require pentiminax/ux-datatables
php bin/console make:datatable

Declare the table:

use App\Entity\User;
use Pentiminax\UX\DataTables\Attribute\AsDataTable;
use Pentiminax\UX\DataTables\Column\DateColumn;
use Pentiminax\UX\DataTables\Column\NumberColumn;
use Pentiminax\UX\DataTables\Column\TextColumn;
use Pentiminax\UX\DataTables\Model\AbstractDataTable;

#[AsDataTable(User::class)]
final class UserDataTable extends AbstractDataTable
{
    public function configureColumns(): iterable
    {
        return [
            NumberColumn::new('id', 'ID'),
            TextColumn::new('firstName', 'First name'),
            TextColumn::new('email', 'Email'),
            DateColumn::new('createdAt', 'Created at'),
        ];
    }
}

Pass it to your template:

#[Route('/users', name: 'app_users')]
public function index(UserDataTable $table): Response
{
    return $this->render('user/index.html.twig', ['table' => $table]);
}

Render it in Twig:

{{ render_datatable(table) }}

That's it!

πŸ“– Read the full documentation β†’

Features

Feature Description
⚑ Table in Minutes Scaffold a table from any Doctrine entity with make:datatable
πŸ—„οΈ Server-side Processing Pagination, search, and ordering handled through Doctrine, in-memory arrays, or API Platform
πŸŽ›οΈ Typed Columns Text, number, money, date, boolean, enum, and more, configured fluently
πŸ” Filters Built-in filters and column controls to narrow down your data
βš™οΈ Actions Row actions, bulk actions over selected rows, and detail rows
✏️ Inline Editing Edit rows in a modal or toggle booleans in place, with CSRF protection
πŸ“€ Exports CSV and XLSX exports through the same query pipeline
🧩 DataTables Extensions Buttons, Select, Responsive, FixedHeader, RowGroup, SearchBuilder, and more, lazy-loaded
πŸ“‘ Live Updates Optional Mercure integration to push changes to the table
🎨 Bootstrap & Modals Style and modal adapters you can swap or extend
🌍 Translatable English and French catalogs included
βœ… Testable DataTableTestCase exercises your table through the same Ajax routes as the browser

Requirements

  • PHP 8.3 or higher
  • Symfony 7.4 or 8.x
  • Symfony StimulusBundle 2.x or 3.x

Security

The bundle registers Ajax routes under /datatables/ajax/* for data, edit, delete, detail, bulk actions, and exports. The table token embedded in the page identifies which table is requested, not who requests it. Protect these routes with your Symfony Security configuration:

# config/packages/security.yaml
security:
    access_control:
        - { path: ^/datatables/ajax, roles: ROLE_ADMIN }

See Securing Ajax Routes for details.

Demo

A Symfony demo app in demo/ tours columns, filters, actions, exports, and extensions, each page next to the code running it:

cd demo
composer install
php bin/console app:demo:reset
php -S 127.0.0.1:8000 -t public

Contributing

Contributions are welcome. Read the contribution guidelines, then open an issue to discuss your idea or send a pull request.

License

This bundle is released under the MIT License.