ram-electronic/datatable-bundle

Reusable DataTable and Pagination bundle for Symfony applications

Maintainers

Package info

github.com/ram-electronic/datatable-bundle

Type:symfony-bundle

pkg:composer/ram-electronic/datatable-bundle

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.0.1 2026-08-17 18:59 UTC

README

Reusable DataTable and Pagination bundle for Symfony applications: filterable, sortable, paginated table views built on Doctrine ORM, Symfony Forms, and Symfony UX Live Components.

Requirements

  • PHP 8.4+
  • Symfony 7.0+ (framework-bundle, form, routing, security-csrf, translation, validator)
  • Symfony UX live-component and twig-component 2.0+
  • Doctrine orm 3.0+ and doctrine-bundle 2.11+

Installation

composer require ram-electronic/datatable-bundle

If your app doesn't use Symfony Flex, register the bundle manually in config/bundles.php:

return [
    // ...
    RamElectronic\DataTableBundle\DataTableBundle::class => ['all' => true],
];

Twig components

The bundle registers its Twig components under the RamElectronic\DataTableBundle\Presentation\Twig\Components namespace, with one exception: Table, Pagination, and the Table\Body, Table\Cell, Table\Head, Table\Header, and Table\Row components are not auto-registered (see config/services.php). Those names collide with anonymous Twig components most consuming apps already define for their own markup, so you're expected to supply your own Table/Row/Cell/etc. and compose them with the parts the bundle does register:

  • FilterForm / FilterCondition — Live Components backing the filter UI
  • PaginationControl — pagination controls
  • Table:ActionsCell, Table:DataCell, Table:HeadRow, Table:SortableHeader

See templates/components/ for the reference markup these components render.

Usage

  1. Define your filterable columns with an Application\ReadModel\FilterFieldRegistry subclass built from Column definitions.
  2. Extend Infrastructure\Repository\DoctrineTableReadModelRepository for your read-model entity's repository — it provides filtering, sorting, and pagination against a Doctrine QueryBuilder given a field-to-column mapping.
  3. In your controller, build a TableCriteria from request/form data via Presentation\Service\TableCriteriaBuilder (which composes FilterCollectionBuilder), and pass it to your repository.
  4. Render results with PaginationControl and the bundle's Table:* components inside your own table markup.

Testing

composer install
vendor/bin/phpunit

License

MIT, see LICENSE.