PHPackages                             m-adamski/symfony-fetch-table - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. m-adamski/symfony-fetch-table

ActiveSymfony-bundle

m-adamski/symfony-fetch-table
=============================

The Symfony bundle for interaction with the JS Fetch Table library

0.1.0(7mo ago)11MITPHPPHP &gt;=8.2

Since Oct 3Pushed 7mo agoCompare

[ Source](https://github.com/m-adamski/symfony-fetch-table)[ Packagist](https://packagist.org/packages/m-adamski/symfony-fetch-table)[ RSS](/packages/m-adamski-symfony-fetch-table/feed)WikiDiscussions 0.1 Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

Fetch Table Bundle for Symfony
==============================

[](#fetch-table-bundle-for-symfony)

The Symfony bundle that integrates the lightweight [Fetch Table JS](https://github.com/m-adamski/fetch-table) library to handle remote data fetching and render responsive, accessible HTML tables.

Installation
------------

[](#installation)

This bundle is available on Packagist and can be installed using Composer:

```
composer require m-adamski/symfony-fetch-table
```

How to use it?
--------------

[](#how-to-use-it)

The library is designed to run within controller logic. It automatically generates configuration for the JS library and handles incoming HTTP requests.

```
public function __construct(
    private readonly FetchTableFactory $fetchTableFactory,
) {}

#[Route("/", name: "index", methods: ["GET"])]
public function index(Request $request): Response {
    $table = $this->fetchTableFactory
            ->create("#fetch-table", [
                "ajaxURL"    => $this->generateUrl("index"),
                "ajaxMethod" => "GET",
                "components" => [
                    "search"     => [
                        "active" => true,
                    ],
                    "pagination" => [
                        "active"   => true,
                    ]
                ]
            ])
            ->addColumn("title", TextColumn::class, [
                "label" => "Title",
                "searchable" => true,
                "sortable" => true
            ])
            ->addColumn("description", TextColumn::class, [
                "label" => "Description",
                "searchable" => true,
                "sortable" => true
            ])
            ->addColumn("author", PropertyColumn::class, [
                "label"    => "Author",
                "property" => "author",
                "sortable" => true
            ])
            ->addColumn("createdAt", DateTimeColumn::class, [
                "label"  => "Creation Date",
                "format" => "d.m.Y H:i",
                "sortable" => true
            ])
            ->addColumn("options", TwigColumn::class, [
                "label"    => "Options",
                "mapped"   => false,
                "expanded" => true,
                "template" => "column/options.html.twig",
            ])
            ->createAdapter(RepositoryAdapter::class, [
                "entity"       => Book::class,
                "queryBuilder" => function (BookRepository $bookRepository) {
                    return $bookRepository->createQueryBuilder("book");
                }
            ]);

    if (null !== ($tableResponse = $table->handleRequest($request))) {
        return $tableResponse;
    }

    return $this->render("index.html.twig", [
        "table" => $table,
    ]);
}
```

Documentation
-------------

[](#documentation)

Detailed documentation of the JS library can be found at .

### Columns Configuration

[](#columns-configuration)

The bundle provides a set of column types that can be used to process and render different types of data.

All columns accept basic configuration parameters:

- type (string, default: "text") - Column type
- label (string, required) - Column label
- className (string, optional) - CSS class name of the column
- sortable (boolean, default: false) - Whether the column should be sortable
- searchable (boolean, default: false) - Whether the column should be searchable
- mapped (boolean, default: true) - Whether the column should be mapped to the data source

#### TextColumn::class

[](#textcolumnclass)

Example:

```
->addColumn("title", TextColumn::class, [
    "label" => "Title",
    "searchable" => true,
    "sortable" => true
])
```

The column has no additional configuration parameters.

#### PropertyColumn::class

[](#propertycolumnclass)

Example:

```
->addColumn("author", PropertyColumn::class, [
    "label"    => "Author",
    "property" => "author",
    "sortable" => true
])
```

- property (string, required) - Property name of the entity
- defaultValue (string | int | float, default: "") - Default value if property is null or undefined
- expanded (boolean, default: true) - Whether the column value should be expanded

#### DateTimeColumn::class

[](#datetimecolumnclass)

Example:

```
->addColumn("createdAt", DateTimeColumn::class, [
    "label"  => "Creation Date",
    "format" => "d/m/Y H:i",
    "sortable" => true
])
```

- format (string, default: "Y-m-d H:i:s") - Date format

#### CallableColumn::class

[](#callablecolumnclass)

Example:

```
->addColumn("description", CallableColumn::class, [
    "label"      => "Email Address",
    "callable"   => function (string $description) {
        return "Description: $description";
    },
    "searchable" => true,
    "sortable"   => true
])
```

```
->addColumn("description", CallableColumn::class, [
    "label"      => "Email Address",
    "callable"   => function (Book $book) {
        return "Description: " . $book->getDescription();
    },
    "expanded"   => true,
    "searchable" => true,
    "sortable"   => true
])
```

- callable (callable, required) - Callable that accepts the column value and returns the rendered value
- expanded (boolean, default: false) - Whether the column value should be expanded

### Adapters Configuration

[](#adapters-configuration)

The bundle provides a set of adapters that can be used to fetch data from different sources.

#### ArrayAdapter::class

[](#arrayadapterclass)

The adapter expects a table of data as a configuration parameter and handles all search, sorting, and pagination functionality internally.

Example:

```
->createAdapter(ArrayAdapter::class, [
    "data" => [
        ["name" => "John Doe", "emailAddress" => "test@example.com"],
        ["name" => "Jane Smith", "emailAddress" => "jane.smith@example.com"],
        ["name" => "Michael Brown", "emailAddress" => "michael.brown@example.com"],
        ["name" => "Emily Davis", "emailAddress" => "emily.davis@example.com"],
        ["name" => "David Wilson", "emailAddress" => "david.wilson@example.com"],
        ["name" => "Sarah Johnson", "emailAddress" => "sarah.johnson@example.com"],
    ]
]);
```

- data (array, required) - Array of data

#### CallableAdapter::class

[](#callableadapterclass)

The only configuration parameter for this adapter is a function that will be called when the data is rendered. We must provide support for searching, sorting, and pagination within this function.

Example:

```
->createAdapter(CallableAdapter::class, [
    "callable" => function (Query $query, $transformer, $columns, $config) {

        // Searching
        if (null !== ($searchContent = $query->getSearch())) {
            // ...
        }

        // Sorting
        if (null !== ($sort = $query->getSort())) {
            // ...
        }

        // Pagination
        if (null !== ($pagination = $query->getPagination())) {
            // ...
        }

        return (new Result())->setData(
            $transformer->transform([
                ["title" => "Title 1", "author" => "Author 1", "createdAt" => new \DateTime()],
                ["title" => "Title 2", "author" => "Author 2", "createdAt" => new \DateTime()],
            ], $columns)
        );
    }
]);
```

- callable (callable, required) - Callable that accepts the query, transformer, columns, and config and returns the result

#### RepositoryAdapter::class

[](#repositoryadapterclass)

To use this adapter, you need to install the symfony/orm-pack package. The adapter handles search, sorting, and pagination functionality internally.

Example:

```
->createAdapter(RepositoryAdapter::class, [
    "entity"       => Book::class,
    "queryBuilder" => function (BookRepository $bookRepository) {
        return $bookRepository->createQueryBuilder("book");
    }
]);
```

- entity (string, required) - Entity class name
- queryBuilder (callable, required) - Callable that accepts the entity repository and returns the query builder (if there is a need to bypass the internal functionality of the adapter (search, sorting, and pagination), the function can return the result immediately)

License
-------

[](#license)

This project is open source and available for personal and commercial use under the MIT License.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance64

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

221d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99031579203ae7aff3a32b3309374cb5703c35abc4737509bc6b228b433d9943?d=identicon)[m-adamski](/maintainers/m-adamski)

---

Top Contributors

[![m-adamski](https://avatars.githubusercontent.com/u/21038303?v=4)](https://github.com/m-adamski "m-adamski (3 commits)")

---

Tags

phpsymfonysymfony-bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/m-adamski-symfony-fetch-table/health.svg)

```
[![Health](https://phpackages.com/badges/m-adamski-symfony-fetch-table/health.svg)](https://phpackages.com/packages/m-adamski-symfony-fetch-table)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
