zhortein / datatable-bundle
A Symfony 8+ bundle for Bootstrap-first business datatables driven by PHP definitions, with Twig rendering, Stimulus Ajax refresh, Doctrine provider, actions, filters and CSV/XLSX exports.
Package info
github.com/Zhortein/datatable-bundle
Type:symfony-bundle
pkg:composer/zhortein/datatable-bundle
Requires
- php: >=8.4
- symfony/config: ^8.0
- symfony/dependency-injection: ^8.0
- symfony/http-foundation: ^8.0
- symfony/http-kernel: ^8.0
- symfony/routing: ^8.0
- symfony/security-core: ^8.0
- symfony/security-csrf: ^8.0
- symfony/translation: ^8.0
- symfony/twig-bundle: ^8.0
- symfony/yaml: ^8.0
- twig/twig: ^3.21
Requires (Dev)
- doctrine/doctrine-bundle: ^3.2
- doctrine/orm: ^3.4.4 || ^4.0
- friendsofphp/php-cs-fixer: ^3.95
- friendsoftwig/twigcs: ^6.0
- openspout/openspout: ^5.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^12.0
- symfony/doctrine-bridge: ^8.0
- symfony/event-dispatcher-contracts: ^3.6
- symfony/framework-bundle: ^8.0
- symfony/translation-contracts: ^3.6
- symfony/var-dumper: ^8.0
Suggests
- ext-intl: Recommended for locale-aware datetime formatting through IntlDateFormatter.
- doctrine/doctrine-bundle: Required to use Doctrine ORM backed datatables in Symfony applications.
- doctrine/orm: Required to use Doctrine ORM backed datatables.
- openspout/openspout: Required to enable XLSX export support.
- symfony/asset-mapper: Recommended to expose the provided Stimulus controller with Symfony AssetMapper.
- symfony/stimulus-bundle: Recommended to integrate the provided vanilla Stimulus controller.
This package is auto-updated.
Last update: 2026-05-27 22:12:36 UTC
README
A Symfony 8+ bundle for Bootstrap-first business datatables driven by PHP definitions.
Status
Alpha Stage. This bundle is under active development. The public API may change before the 1.0.0 release.
Requirements
- PHP: 8.4+
- Symfony: 8.0+
- Frontend: Bootstrap 5 (CSS/JS), Symfony UX Stimulus, and AssetMapper.
Features
- PHP-first Definitions: Declare your datatables as PHP classes with attributes.
- Twig Rendering: Render tables with a single Twig function:
{{ zhortein_datatable() }}. - Ajax Fragments: Seamless server-side updates using vanilla Stimulus.
- Data Providers: Native support for Doctrine ORM and Array providers.
- Filtering: Built-in global search and permanent backend filters.
- Actions: Declarative row and global actions with CSRF-aware non-GET support.
- Exports: Server-side CSV and optional XLSX exports.
- Customization: Flexible UI/UX customization via Twig blocks and themes.
- Type Safety: Automatic Doctrine type detection and typed cell rendering.
Installation Summary
- Install the package:
composer require zhortein/datatable-bundle
Note that there is no automatic recipe for this bundle for now.
-
Register the bundle (if not done by Flex) in
config/bundles.php. -
Import routes:
# config/routes/zhortein_datatable.yaml zhortein_datatable: resource: '@ZhorteinDatatableBundle/config/routes.php'
-
Expose the Stimulus controller: Ensure
symfony/stimulus-bundleis installed and the controller is enabled inassets/controllers.json. -
Bootstrap requirement: Ensure Bootstrap 5 CSS and JS are loaded in your layout.
See Installation Guide for detailed instructions.
Minimal Example
1. Define your Datatable
namespace App\Datatable; use App\Entity\User; use Zhortein\DatatableBundle\Attribute\AsDatatable; use Zhortein\DatatableBundle\Contract\DatatableInterface; use Zhortein\DatatableBundle\Definition\DatatableDefinition; #[AsDatatable(name: 'users')] final class UserDatatable implements DatatableInterface { public function buildDatatable(DatatableDefinition $definition): void { $definition ->setEntityClass(User::class) ->addColumn('e.id', visible: false) ->addColumn('e.email', label: 'Email') ->addColumn('e.createdAt', label: 'Created At', searchable: false) ; } }
2. Render it in Twig
{{ zhortein_datatable('users', { search: true }) }}
Documentation
- Documentation Index
- Installation
- Quick Start
- Providers Overview
- Doctrine Provider
- Filters
- Actions & Security
- Exports
- Theming & Templates
- UI/UX & Controls
- Frontend Test Strategy
- Roadmap
License
MIT