Skip to content

Installation

This bundle can be installed at any moment during a project’s lifecycle.

Download the bundle

Use Composer to install the bundle:

composer require kreyu/data-table-bundle

Enable the bundle

Enable the bundle by adding it to the config/bundles.php:

// config/bundles.php
return [
    // ...
    Kreyu\Bundle\DataTableBundle\KreyuDataTableBundle::class => ['all' => true],
];

Enable the Symfony UX integration

This bundle provides front-end scripts created using the Stimulus JavaScript framework. To begin with, make sure your application uses the Symfony Stimulus Bridge.

Add dependency to package.json

Check your package.json, that should contain a @kreyu/data-table-bundle dependency:

{
    "devDependencies": {
        "@kreyu/data-table-bundle": "file:vendor/kreyu/data-table-bundle/assets"
    }
}

Enable the Stimulus controller

Check your assets/controllers.json file, which should contain the @kreyu/data-table-bundle configuration:

{
    "controllers": {
        "@kreyu/data-table-bundle": {
            "personalization": {
                "enabled": true
            }
        }
    }
}

Install dependencies and build the front-end

yarn install && yarn build

Enable the translator service

The translator service is required by the bundle to display all labels properly. For more information, see Symfony translation documentation.

# config/packages/translation.yaml
framework:
  default_locale: 'en'
  translator:
    default_path: '%kernel.project_dir%/translations'

This bundle supports two locales out of the box: English (en) and Polish (pl).

Select theme

By default, a base HTML theme is used. It's primary role is to work as a base theme for other themes.

The following themes are natively available in the bundle:

To select a theme, provide which one to use in the bundle configuration file:

# config/packages/kreyu_data_table.yaml
kreyu_data_table:
  themes:
    - '@KreyuDataTable/themes/bootstrap_5.html.twig'

For more information, see theming documentation section.