A Symfony 8+ bundle for Bootstrap-first business datatables driven by PHP definitions.
Alpha Stage. This bundle is under active development. The public API may change before the 1.0.0 release.
- 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 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.
- 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.
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)
;
}
}{{ zhortein_datatable('users', { search: true }) }}- Documentation Index
- Installation
- Quick Start
- Providers Overview
- Doctrine Provider
- Filters
- Actions & Security
- Exports
- Theming & Templates
- UI/UX & Controls
- Frontend Test Strategy
- Roadmap
MIT