PHPackages                             trinity/grid - 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. trinity/grid

ActiveSymfony-bundle

trinity/grid
============

Trinity Grid bundle

23.1kPHP

Since Dec 2Pushed 8y ago25 watchersCompare

[ Source](https://github.com/modpreneur/trinity-grid)[ Packagist](https://packagist.org/packages/trinity/grid)[ RSS](/packages/trinity-grid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Trinity Grid

Trinity grid is part of Trinity package.

Description:

- Converts an array of entities to array of strings.
- Array of string is convert to JSON:

\##Documentation

\###Grid Template

\####1) Create Grid Template

Create class extended by BaseGrid. Add templates for change attributes value.

```
class ProductGrid extends BaseGrid
{
    public function setUp()
    {
        $this->addTemplate("ProductGrid.html.twig"); // add new twig template for changing values.
    }
}

```

\#####Set up addTemplate - add new template for changing values. setColumnFormat - for basic change value of date or simple text edit. @todo Jancar example (dog eyes, nicely please)

\#####Template:

For change value of cell use block cell\_attributeName.

```
{% block cell_name %} Template edit - {{ value }} {% endblock %}

```

**Available variables:**

- value = value of cell
- row = entity object

\####2) Register Grid Template

In services.yml

```
services:
  trinity.grid.test.product:
    class: Trinity\Bundle\GridBundle\Tests\Functional\Grid\ProductGrid
    tags:
        - { name: trinity.grid, alias: product } // tag name have to be trinity.grid, alias is mandatory value for searching grids from entity name.

```

\###Grid filters

Filters are used to change the attribute values.

\####1) Create filter:

Filter have to inherit from BaseFilter or FilterInterface!

```
class IdFilter extends BaseFilter
{
    /**
     * @var string
     */
    protected $name = 'id';  //mandatory for not global filter

    /**
     * @param string|object|int|bool $input
     * @param array $arguments
     * @return string
     */
    function process($input, array $arguments = []) : string
    {
        return $input.'.';
    }
}

```

\####2) Grid registration:

In services.yml

```
trinity.grid.filter.id:
  class: Trinity\Bundle\GridBundle\Filter\IdFilter
  tags:
    - {name: "trinity.grid.filter"} //tag name have to be trinity.grid.filter

```

\####3) Set up filter for current grid:

```
 $this->setColumnFilter('columnName', 'filterName');

```

\####4) Global filters

For global filter must be set attribute 'global' to TRUE;

Attribute 'name' is not necessary.

```
class ObjectFilter extends BaseFilter
{
    protected $global = true;

    /**
     * @param string|object|int|bool $input
     * @param array $arguments
     * @return string
     */
    function process($input, array $arguments = []) : string
    {
        if ((is_object($input) && method_exists($input, 'getName'))) {
            $input = $input->getName();
        } elseif (is_object($input)) {
            $input = (string)$input;
        }
        return $input;
    }
}

```

\###Parse entity array to array of strings

From container pull service 'trinity.grid.manager'

```
$manager = $container->get('trinity.grid.manager');

```

Parse array of entities:

```
$stringArray = $manager->convertEntitiesToArray(
            $this->getArrayOfEntities(),                                        // array of entities
            ['id', 'name', 'description', 'nonexistentColumn', 'createdAt']     // columns
        );

```

From the entity name is found grid. $stringArray is must be convert to JSON.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/44273a4ac0f029f29c2e5f37a72fbf0a0059927d2674a7417d8f14066e3c75e6?d=identicon)[modpreneur](/maintainers/modpreneur)

---

Top Contributors

[![prodejledu](https://avatars.githubusercontent.com/u/5036996?v=4)](https://github.com/prodejledu "prodejledu (28 commits)")[![Bordovsky](https://avatars.githubusercontent.com/u/14068785?v=4)](https://github.com/Bordovsky "Bordovsky (14 commits)")[![Rockuo](https://avatars.githubusercontent.com/u/10503337?v=4)](https://github.com/Rockuo "Rockuo (6 commits)")[![jjanekk](https://avatars.githubusercontent.com/u/2411050?v=4)](https://github.com/jjanekk "jjanekk (6 commits)")[![momasta](https://avatars.githubusercontent.com/u/7421124?v=4)](https://github.com/momasta "momasta (5 commits)")[![matejkam92](https://avatars.githubusercontent.com/u/13829924?v=4)](https://github.com/matejkam92 "matejkam92 (4 commits)")[![Nialaren](https://avatars.githubusercontent.com/u/4409189?v=4)](https://github.com/Nialaren "Nialaren (3 commits)")[![Jakub-Fajkus](https://avatars.githubusercontent.com/u/13538235?v=4)](https://github.com/Jakub-Fajkus "Jakub-Fajkus (1 commits)")[![GeretCZE](https://avatars.githubusercontent.com/u/19844372?v=4)](https://github.com/GeretCZE "GeretCZE (1 commits)")

### Embed Badge

![Health badge](/badges/trinity-grid/health.svg)

```
[![Health](https://phpackages.com/badges/trinity-grid/health.svg)](https://phpackages.com/packages/trinity-grid)
```

PHPackages © 2026

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