A Symfony 8+ bundle for Bootstrap-first business datatables driven by PHP definitions.
Stable 1.x. The documented public API follows Semantic Versioning and is covered by the compatibility policy.
- PHP: 8.4+
- Symfony: 8.0+
- Frontend: Bootstrap 5 (CSS/JS), Symfony UX Stimulus, and AssetMapper.
- 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 Doctrine ORM, Array and optional remote HTTP/API providers.
- Filtering: Built-in global search, toolbar/header filters, and advanced Search Builder.
- Multi-column Sorting: Ordered, accessible sorting shared by providers, URL state, saved views, and exports.
- Shareable State: Per-instance URL state with browser history and Turbo restoration.
- Named Views: Optional saved views with replaceable ownership, authorization and storage contracts.
- Streaming Exports: Bounded-memory Doctrine, CSV and XLSX pipelines with explicit provider/writer capabilities.
- Guarded Exports: Server-side CSV/XLSX row limits, preflight counting and replaceable authorization.
- Asynchronous Exports: Optional owner-bound background jobs with storage-agnostic persistence and Symfony Messenger integration.
- Actions: Declarative row, global and bulk actions with CSRF-aware forms and opt-in Ajax execution.
- 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.
- Rich Enums: Localized enum labels with optional badges, colors and icons, shared by filters and exports.
- Rich Cells: Complete server-side cell context and reusable computed values shared with exports.
- Hierarchical Tables: Accessible lazy child datatables with signed context, isolated state, and independent providers.
Install the PHP dependencies:
composer require zhortein/datatable-bundle
composer require symfony/asset-mapper symfony/asset symfony/stimulus-bundleThe bundle does not currently provide a Symfony Flex recipe. The host application must:
- register
ZhorteinDatatableBundleinconfig/bundles.php; - import
@ZhorteinDatatableBundle/config/routes.php; - enable
@zhortein/datatable-bundle/datatableinassets/controllers.json; - install and import Bootstrap 5 and Bootstrap Icons;
- render the AssetMapper
appentrypoint in the base layout.
Add the frontend dependencies:
php bin/console importmap:require bootstrap
php bin/console importmap:require bootstrap-icons/font/bootstrap-icons.min.cssFollow the Installation Guide for the exact file contents, verification commands and troubleshooting. Then use the Quick Start to create a complete working page.
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, type: 'datetime')
;
}
}{{ zhortein_datatable('users', { search: true }) }}- Documentation Index
- Installation
- Quick Start
- Providers Overview
- Doctrine Provider
- HTTP/API Provider
- Filters
- Advanced Filters
- Enum Presentation
- Multi-column Sorting
- URL State & Browser History
- Named Saved Views
- Actions & Security
- Bulk Actions & Selection
- Exports
- Asynchronous Export Jobs
- UI/UX & Controls
- Icon System
- Theming & Templates
- Cell Context & Computed Values
- Hierarchical Datatables
- Public API & Compatibility
- Frontend Test Strategy
- Roadmap
MIT