pentiminax / ux-datatables
DataTables.net integration for Symfony
Package info
github.com/pentiminax/ux-datatables
Type:symfony-bundle
pkg:composer/pentiminax/ux-datatables
Requires
- php: >=8.3
- symfony/config: ^7.0 || ^8.0
- symfony/dependency-injection: ^7.0 || ^8.0
- symfony/deprecation-contracts: ^2.5 || ^3.0
- symfony/http-kernel: ^7.0 || ^8.0
- symfony/property-access: ^7.0 || ^8.0
- symfony/security-bundle: ^7.0 || ^8.0
- symfony/security-csrf: ^7.0 || ^8.0
- symfony/stimulus-bundle: ^2.0 || ^3.0
Requires (Dev)
- api-platform/core: ^3.0 || ^4.0 || ^5.0
- doctrine/orm: ^3.0
- friendsofphp/php-cs-fixer: ^3.95
- openspout/openspout: ^4.0
- phpunit/phpunit: ^12.0
- symfony/asset-mapper: ^7.0 || ^8.0
- symfony/browser-kit: ^7.0 || ^8.0
- symfony/css-selector: ^7.0 || ^8.0
- symfony/dom-crawler: ^7.0 || ^8.0
- symfony/expression-language: ^7.0 || ^8.0
- symfony/form: ^7.0 || ^8.0
- symfony/framework-bundle: ^7.0 || ^8.0
- symfony/maker-bundle: ^1.66
- symfony/mercure-bundle: ^0.5.0
- symfony/phpunit-bridge: ^7.0 || ^8.0
- symfony/property-info: ^7.0 || ^8.0
- symfony/translation: ^7.0 || ^8.0
- symfony/twig-bundle: ^7.0 || ^8.0
- symfony/var-dumper: ^7.0 || ^8.0
- symfony/web-profiler-bundle: ^7.0 || ^8.0
Suggests
- api-platform/core: To auto-detect columns from API Platform metadata.
- openspout/openspout: To enable server-side CSV and XLSX export via Button::csv(serverSide: true) and Button::excel(serverSide: true).
- symfony/browser-kit: To test your tables with Pentiminax\UX\DataTables\Test\DataTableTestCase.
- symfony/css-selector: To let DataTableTestCase::dataTableView() locate a rendered table in the page.
- symfony/dom-crawler: To assert on client-side tables with DataTableTestCase::dataTableView().
- symfony/expression-language: To use Symfony Expression objects with setPermission().
- symfony/form: To enable inline edit modal with auto-generated forms.
- symfony/maker-bundle: To use the make:datatable command.
- symfony/mercure-bundle: To enable real-time DataTable updates via Mercure SSE.
- symfony/translation: To translate DataTable column titles and the filter bar labels (Filters/Reset/Apply/All).
- symfony/twig-bundle: To render edit form and TwigColumn
Provides
None
Conflicts
- symfony/flex: <1.13
Replaces
None
- dev-main
- v1.1.1
- v1.1.0
- v1.0.0
- v0.90.0
- v0.89.0
- v0.88.0
- v0.87.0
- v0.86.0
- v0.85.0
- v0.84.0
- v0.83.0
- v0.82.0
- v0.81.0
- v0.80.0
- v0.79.0
- v0.78.0
- v0.77.0
- v0.76.0
- v0.75.0
- v0.74.0
- v0.73.0
- v0.72.0
- v0.71.0
- v0.70.0
- v0.69.1
- v0.69.0
- v0.68.2
- v0.68.1
- v0.68.0
- v0.67.0
- v0.66.0
- v0.65.0
- v0.64.0
- v0.63.0
- v0.62.0
- v0.61.0
- v0.60.0
- v0.59.0
- v0.58.0
- v0.57.0
- v0.56.1
- v0.56.0
- v0.55.1
- v0.55.0
- v0.54.1
- v0.54.0
- v0.53.0
- v0.52.0
- v0.51.0
- v0.50.0
- v0.49.0
- v0.48.0
- v0.47.0
- v0.46.0
- v0.45.0
- v0.44.0
- v0.43.0
- v0.42.0
- v0.41.0
- v0.40.0
- v0.39.0
- v0.38.1
- v0.38.0
- v0.37.0
- v0.36.0
- v0.35.0
- v0.34.0
- v0.33.2
- v0.33.1
- v0.33.0
- v0.32.1
- v0.32.0
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.1
- v0.30.0
- v0.29.1
- v0.29.0
- v0.28.0
- v0.27.1
- v0.27.0
- v0.26.1
- v0.26.0
- v0.25.0
- v0.24.0
- v0.23.0
- v0.21.2
- v0.21.1
- v0.21.0
- v0.20.0
- v0.19.0
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.4
- v0.17.3
- v0.17.2
- v0.17.1
- v0.17.0
- v0.16.0
- v0.15.6
- v0.15.5
- v0.15.4
- v0.15.3
- v0.15.2
- v0.15.1
- v0.15.0
- v0.14.1
- v0.14.0
- v0.13.5
- v0.13.4
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.1
- v0.1.0
- dev-cursor/critical-bug-management-c23f
- dev-cursor/critical-bug-management-eb29
- dev-cursor/critical-bug-management-e59d
- dev-cursor/critical-bug-management-a0c7
- dev-claude/gifted-ramanujan-k1957c
- dev-feat/demo-v1.2-features
- dev-docs/map-row-vs-format-value
- dev-refactor/simplify-v1.2-audit
- dev-cursor/critical-bug-management-e812
This package is auto-updated.
Last update: 2026-10-10 18:21:30 UTC
README
UX DataTables is a Symfony bundle integrating the DataTables library in Symfony applications.
Requirements
- PHP 8.3 or higher
- Symfony StimulusBundle (installed through Symfony UX)
- Composer
Installation
Install the library via Composer:
composer require pentiminax/ux-datatables
Usage
1. Declare a DataTable
use App\Entity\User; use Pentiminax\UX\DataTables\Attribute\AsDataTable; use Pentiminax\UX\DataTables\Column\BooleanColumn; use Pentiminax\UX\DataTables\Column\DateColumn; use Pentiminax\UX\DataTables\Column\MoneyColumn; 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'), ]; } }
Column variants are configured fluently after new():
TextColumn::new('name')->utf8(); TextColumn::new('content')->html()->utf8(); NumberColumn::new('price')->formatted(); MoneyColumn::new('price')->currency('EUR')->storedAsCents(); BooleanColumn::new('active')->renderAsSwitch(); TextColumn::new('internalCode')->disableColumnControl();
disableColumnControl() removes all ColumnControl controls for the column without disabling
DataTables search processing.
2. Wire it in a controller
#[Route('/users', name: 'app_users')] public function index(UserDataTable $table, Request $request): Response { $table->handleRequest($request); if ($table->isRequestHandled()) { return $table->getResponse(); } return $this->render('user/index.html.twig', [ 'table' => $table, ]); }
3. Render in Twig
{{ render_datatable(table) }}
Tip: run
php bin/console make:datatableto scaffold a DataTable class from any Doctrine entity.
Beyond this, a table can declare filters, row actions, bulk actions over the selected rows, inline
editing and exports, and stay live through Mercure or API Platform. DataTableTestCase tests it
through the same Ajax routes the browser uses.
Security
The bundle auto-registers a set of Ajax routes under /datatables/ajax/* (ux_datatables_ajax_data,
ux_datatables_ajax_delete, ux_datatables_ajax_edit, ux_datatables_ajax_edit_form,
ux_datatables_ajax_edit_form_submit, ux_datatables_ajax_detail, ux_datatables_ajax_bulk,
ux_datatables_ajax_export).
The table token embedded in the rendered HTML identifies which table is requested, not who is requesting it — it is not a user-authentication or per-user authorization mechanism. If a table is displayed behind a firewall but these routes are left unprotected, the underlying data (and the edit/delete actions) can be reached by anyone holding the token.
Protect the routes with an access_control rule that matches the pages rendering your tables:
# config/packages/security.yaml security: access_control: # access_control is first-match-wins; place this before any broader rule. - { path: ^/datatables/ajax, roles: ROLE_ADMIN }
Delete actions and inline boolean toggles additionally require an active session for CSRF
protection. Without one, their controls are rendered disabled (mutationsEnabled: false in the
table payload).
See Securing Ajax Routes for details.
Documentation
Demo
A Symfony demo app lives in demo/. It tours columns, filters, actions, bulk 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