PHPackages                             roarbb/datagrid - 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. roarbb/datagrid

ActiveLibrary

roarbb/datagrid
===============

Datagrid is Data renderer with some configuration options

088PHP

Since Jan 25Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Datagrid
========

[](#datagrid)

Datagrid is PHP component to creating tables from a set of data.

Live Example
------------

[](#live-example)

Here: [http://datagrid.sajgal.com](http://datagrid.sajgal.com/).

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

[](#installation)

The recommended way to install Datagrid is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of Datagrid:

```
composer require roarbb/datagrid
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

Basic usage
-----------

[](#basic-usage)

Let's have some array of data:

```
$data = array(
    'row1' => array(
        'name' => 'Tyree',
        'surname' => 'Schmidt',
        'age' => '35',
        'position' => 'Developer',
        'pin' => '7366',
    ),
    'row2' => array(
        'name' => 'Cleve',
        'surname' => 'Streich',
        'age' => '38',
        'position' => 'Management',
        'pin' => '7290',
    ),
    'row3' => array(
        'name' => 'Mossie',
        'surname' => 'Lesch',
        'age' => '41',
        'position' => 'Sales',
        'pin' => '6521',
    ),
    'row4' => array(
        'name' => 'Kayla',
        'surname' => 'Paucek',
        'age' => '21',
        'position' => 'Developer',
        'pin' => '9478',
    ),
    'row5' => array(
        'name' => 'Elva',
        'surname' => 'Haley',
        'age' => '17',
        'position' => 'Management',
        'pin' => '4532',
    ),
);
```

Basic implementation of Datagrid:

```
$datagrid = new Datagrid();
$datagrid->setData($data);
```

Then in template file:

```
Datagrid

```

More Options
------------

[](#more-options)

### Json source

[](#json-source)

If you want to build table from valid JSON REST API response:

```
$datagrid->setDataUrl('http://datagrid.sajgal.com/?getJson');
```

### Table html class attribute

[](#table-html-class-attribute)

If you are using [Bootstrap](http://getbootstrap.com/css/#tables) you may need to set css class to Datagrid.

```
$datagrid->setTableClass('table');
```

### Header Row

[](#header-row)

You can set header row of Datagrid. Count of array elements passed as argument should match count of items in each row element of `$data` variable.

```
$datagrid->addHeader(['First name', 'Surname', 'Age', 'Position', 'PIN Code']);
```

### Sorting

[](#sorting)

If you want to enable sorting of Datagrid rows

```
$datagrid->isSortable();
```

### Hiding Columns

[](#hiding-columns)

If you want to hide some of columns with sensitive content

```
$datagrid->hideColumns(['pin']);
```

### Pagination

[](#pagination)

You can also enable pagination. You should pass **rows per page** integer as first argument.

```
$datagrid->setPagination(10);
```

### Action Buttons

[](#action-buttons)

If you want to add some buttons at the end of each row. You can use placeholders: `{name}` will be translated to `Tyree` etc.

```
$datagrid->addAction('Delete Row', 'http://datagrid.sajgal.com/delete/{name}');
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/1f47cde96e985140636a84a4336f8f199c37322126ccfc09fd1f84a18c017b9d?d=identicon)[roarbb](/maintainers/roarbb)

### Embed Badge

![Health badge](/badges/roarbb-datagrid/health.svg)

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

PHPackages © 2026

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