PHPackages                             thephpguys/spiral-datagrid-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. thephpguys/spiral-datagrid-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

thephpguys/spiral-datagrid-bundle
=================================

v0.0.1(1y ago)16MITPHPPHP &gt;=8.3.9

Since Jul 25Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ThePHPGuys/spiral-datagrid-bundle)[ Packagist](https://packagist.org/packages/thephpguys/spiral-datagrid-bundle)[ RSS](/packages/thephpguys-spiral-datagrid-bundle/feed)WikiDiscussions main Synced 2d ago

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

SpiralDataGridBundle
====================

[](#spiraldatagridbundle)

This bundle provides integration for [spiral/data-grid](https://spiral.dev/docs/component-data-grid) with your Symfony project. Inspired by `spiral/data-grid-bridge` package, it offers the following features:

- Seamless integration of the DataGrid component into a Symfony environment
- Doctrine\\ORM\\QueryBuilder writer for constructing DQL based on filters.
- DataGrid attribute for controllers

**[DataGrid Component Documentation](https://spiral.dev/docs/component-data-grid)**

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require thephpguys/spiral-datagrid-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require thephpguys/spiral-datagrid-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    ThePhpGuys\SpiralDataGridBundle\SpiralDataGridBundle::class => ['all' => true],
];
```

Usage
=====

[](#usage)

### Step 1: Create grid schema

[](#step-1-create-grid-schema)

Create a grid schema by defining filters, sorters, and pagination settings. You can find more filters on the [DataGrid documentation page](https://spiral.dev/docs/component-data-grid/current/en) :

```
namespace App\Grid;
use App\Entity\Product;
use Spiral\DataGrid\GridSchema;
use Spiral\DataGrid\Specification\Filter;
use Spiral\DataGrid\Specification\Pagination\PagePaginator;
use Spiral\DataGrid\Specification\Sorter\Sorter;
use Spiral\DataGrid\Specification\Value\StringValue;

final class ProductGrid extends GridSchema
{

    public function __construct()
    {
        $this->addFilter('search',  new Filter\Any(
            new Filter\Like('e.title'),
            new Filter\Equals('e.article')
        ));
        $this->addSorter('name',new Sorter('e.name'));
        $this->addSorter('article',new Sorter('e.article'));
        $this->setPaginator(new PagePaginator(10, [10, 20, 50, 100]));
    }

    public function withDefaults():array
    {
        return [
            GridFactory::KEY_SORT => ['name'=>'asc']
        ];
    }

    //If this method exists it will be used as response data transformer
    public function __invoke(Product $product):array
    {
        return [
            'id' => $product->getId(),
            'name' => $product->getName(),
            'article' => $product->getArticle(),
        ];
    }
}
```

### Step 2: Register schema as service

[](#step-2-register-schema-as-service)

Register your grid schema as a service in `config/services.yaml`:

```
#config/services.yaml

services:
    App\Grid\ProductGrid:
```

### Step 3: Create controller method

[](#step-3-create-controller-method)

Create a controller method to use the DataGrid:

```
use App\Entity\Product;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Routing\Attribute\Route;
use ThePhpGuys\SpiralDataGridBundle\Attribute\DataGrid

//...
#[Route('/products')]
#[DataGrid(grid: ProductGrid::class)]
public function productsList(EntityManagerInterface $entityManager):QueryBuilder
{
    return $entityManager->createQueryBuilder()->select('*')->from('e',Product::class);
}
//...
```

This setup provides a route with JSON response and query parameters for filters, sorters, and pagination.

### Example Usage

[](#example-usage)

- Filters: [https://localhost/products?filter\[search\]=IPhone](https://localhost/products?filter%5Bsearch%5D=IPhone)
- Sorters: [https://localhost/products?sort\[article\]=desc](https://localhost/products?sort%5Barticle%5D=desc)
- Pagination:

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

709d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/216417?v=4)[Vad](/maintainers/misterx)[@misterx](https://github.com/misterx)

---

Top Contributors

[![misterx](https://avatars.githubusercontent.com/u/216417?v=4)](https://github.com/misterx "misterx (1 commits)")

---

Tags

datagridsymfony-datagrid

### Embed Badge

![Health badge](/badges/thephpguys-spiral-datagrid-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/thephpguys-spiral-datagrid-bundle/health.svg)](https://phpackages.com/packages/thephpguys-spiral-datagrid-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

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