PHPackages                             presentation/grids - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. presentation/grids

Abandoned → [view-components/grids](/?search=view-components%2Fgrids)Library[Utility &amp; Helpers](/categories/utility)

presentation/grids
==================

Flexible Framework-agnostic Data Grids for PHP

v0.5.10(4y ago)862017[24 issues](https://github.com/view-components/grids/issues)MITPHPPHP ^5.5||^7||^8

Since Dec 9Pushed 4y ago14 watchersCompare

[ Source](https://github.com/view-components/grids)[ Packagist](https://packagist.org/packages/presentation/grids)[ RSS](/packages/presentation-grids/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (25)Used By (0)

[![Logo](https://raw.githubusercontent.com/view-components/logo/master/view-components-logo-without-text-42.png)](https://raw.githubusercontent.com/view-components/logo/master/view-components-logo-without-text-42.png) Grids
===============================================================================================================================================================================================================================

[](#-grids)

[![Release](https://camo.githubusercontent.com/9bf7fdd4c9cad3311969b95a02f7789273af10af9bb362e4233f980afaa2f50e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766965772d636f6d706f6e656e74732f67726964732e737667)](https://packagist.org/packages/view-components/grids)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/37752c4d47adfa31f651805736ee2d9577441dc84d22a18e336715417454780d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766965772d636f6d706f6e656e74732f67726964732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/view-components/grids/?branch=master)[![Build Status](https://camo.githubusercontent.com/ba6e615f75688533295b760ce788f13d97084d8a7d01504459cd86a85508c646/68747470733a2f2f7472617669732d63692e6f72672f766965772d636f6d706f6e656e74732f67726964732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/view-components/grids)[![Code Coverage](https://camo.githubusercontent.com/fd6335b85fc2fd130ba60a93cf98a112297b5c879752bbad09797fa4f5a51e46/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766965772d636f6d706f6e656e74732f67726964732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/view-components/grids/?branch=master)

### `Flexible Framework-agnostic Data Grids for PHP`

[](#flexible-framework-agnostic-data-grids-for-php)

##### This project is a successor of [nayjest/grids](https://github.com/Nayjest/Grids) (Data Grids Framework for Laravel).

[](#this-project-is-a-successor-of-nayjestgrids-data-grids-framework-for-laravel)

This package is framwork-agnostic in sense of both backend and frontend frameworks, i.e.:

- You can use it with any PHP framework or without it. Integration packages will help you to use facilities of popular PHP frameworks.
- Don't worry about fitting markup to your favorite CSS framework. Just describe grid structure and add one of available customizations that will apply framework-specific modifications to markup.

Project status: **beta** *since 2016-03-31*

**Have questions? [Ask in issue-tracker](https://github.com/view-components/grids/issues/new)**.

**Screenshot:**

[![screenshot](https://camo.githubusercontent.com/43d485eee69159faba96c60ab1e9c502675b5929bb089bf424506e0dfca0ec5c/68747470733a2f2f692e6779617a6f2e636f6d2f62653634633561636562623739383262656139666236666466663535383665322e706e67)](https://camo.githubusercontent.com/43d485eee69159faba96c60ab1e9c502675b5929bb089bf424506e0dfca0ec5c/68747470733a2f2f692e6779617a6f2e636f6d2f62653634633561636562623739383262656139666236666466663535383665322e706e67)

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
    - [Installing into Existing Project](#installing-into-existing-project)
    - [Installing as Stand-alone Project](#installing-as-stand-alone-project)
- [Integrations](#integrations)
- [Usage](#usage)
- [Demo Application](#demo-application)
    - [Working Demo Deployed to Heroku](#working-demo-deployed-to-heroku)
    - [Running Demo Application Locally](#running-demo-application-locally)
- [Documentation](#documentation)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)

Features
--------

[](#features)

- Flexible component architecture
- Can be used with wide variety of data sources (php array, PDO database connection, Laravel ActiveRecord or QueryBuilder, Doctrine DBAL Query builder, etc)
- Themes / Customizations / Styling
- Can be used with any PHP framework, has integration packages for popular frameworks.
- Don't worry about fitting markup for your favorite CSS framework. Just describe grid structure and components and then apply customization. This package is framework-agnostic in sense of frontend frameworks and bundled with themes for Twitter Bootstrap, Foundation, Semantic UI
- Alot of components ready to use: filters, sorting, totals, row details, pagination, CSV export
- User-friendly for developers (documentation in progress)

Requirements
------------

[](#requirements)

- PHP 5.5+ (hhvm &amp; php7 are supported)

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

[](#installation)

### Installing into Existing Project

[](#installing-into-existing-project)

The recommended way of installing the component is through [Composer](https://getcomposer.org).

Run following command from your project folder:

```
composer require view-components/grids
```

#### Add-ons

[](#add-ons)

If you use Laravel, install also [eloquent-data-processing](https://github.com/view-components/eloquent-data-processing) package.

```
composer require view-components/eloquent-data-processing
```

This will give possibility to use Eloquent models and query builder instances as data source for grid.

For Doctrine users, there is [doctrine-data-processing](https://github.com/view-components/doctrine-data-processing) package available.

```
composer require view-components/doctrine-data-processing
```

### Installing as Stand-alone Project

[](#installing-as-stand-alone-project)

For running tests and demo-application bundled with this package on your system you need to install it as stand-alone project.

```
composer create-project view-components/grids

```

This is the equivalent of doing a git clone followed by a "composer install" of the vendors. Composer will automatically run 'post-create-project-cmd' command and that will call interactive installation.

If you want to use default settings and run it silently, just add `--no-interaction` option.

If you already cloned this repository, or you want to reinstall the package, navigate to the package folder and run `composer create-project` command without specifying package name.

If you are sure that you don't need to reinstall composer dependencies, you can execute only bundled installer: `composer run post-create-project-cmd`

This kind of installation has additional requirements:

- ext-curl
- ext-pdo\_sqlite

Integrations
------------

[](#integrations)

AreaFrameworkComponentPackageStatusBackendLaravel(Eloquent)Eloquent Data Provider[view-components/eloquent-data-processing](https://github.com/view-components/eloquent-data-processing)Ready, StableBackendLaravel(Blade)Blade RendererPlannedBackendSymfony(Twig)Twig RendererPlannedBackendZend Framework 2/3\*PlannedBackendYii 2\*PlannedBackendDoctrine(DBAL)Doctrine(DBAL) Data Provider[view-components/doctrine-dbal-processing](https://github.com/view-components/doctrine-data-processing)Ready, BetaBackendAnyPHP Array Data ProviderBundledReady, UnstableBackendAnyPDO Data ProviderBundledReady, UnstableFrontendTwitter BootstrapBootstrap View CustomizationBundledReady, BetaFrontendFoundation by ZURBFoundation View CustomizationBundledReady, UnstableFrontendSemantic UISemantic UI View CustomizationBundledReady, UnstableFrontendYahoo PureYahoo Pure View CustomizationPlannedFrontendUIKitUIKit View CustomizationPlannedUsage
-----

[](#usage)

Basic example:

```
$provider = new DbTableDataProvider($pdoConnection, 'my_table');
$input = new InputSource($_GET);

// create grid
$grid = new Grid(
    $provider,
    // all components are optional, you can specify only columns
    [
        new TableCaption('My Grid'),
        new Column('id'),
        new Column('name'),
        new Column('role'),
        new Column('birthday'),
        (new Column('age'))
            ->setValueCalculator(function ($row) {
                return DateTime
                    ::createFromFormat('Y-m-d', $row->birthday)
                    ->diff(new DateTime('now'))
                    ->y;
            })
            ->setValueFormatter(function ($val) {
                return "$val years";
            })
        ,
        new DetailsRow(new SymfonyVarDump()), // when clicking on data rows, details will be shown
        new PaginationControl($input->option('page', 1), 5), // 1 - default page, 5 -- page size
        new PageSizeSelectControl($input->option('page_size', 5), [2, 5, 10]), // allows to select page size
        new ColumnSortingControl('id', $input->option('sort')),
        new ColumnSortingControl('birthday', $input->option('sort')),
        new FilterControl('name', FilterOperation::OPERATOR_LIKE, $input->option('name')),
        new CsvExport($input->option('csv')), // yep, that's so simple, you have CSV export now
        new PageTotalsRow([
            'id' => PageTotalsRow::OPERATION_IGNORE,
            'age' => PageTotalsRow::OPERATION_AVG
        ])
    ]
);

// now you can render it:
echo $grid->render();
// or even this way:
echo $grid;

//  but also you can add some styling:
$customization = new BootstrapStyling();
$customization->apply($grid);
echo $grid;
```

Demo Application
----------------

[](#demo-application)

This package bundled with demo-application.

Source code of demos available [here](https://github.com/view-components/grids/blob/master/tests/webapp/Controller.php)

### Working Demo Deployed to Heroku

[](#working-demo-deployed-to-heroku)

Travis CI automatically deploys web-application bundled with this package to Heroku.

Here you can see working demos:

*First run may be slow because Heroku shutting down workers when there is no traffic and starts it again on first visit*

### Running Demo Application Locally

[](#running-demo-application-locally)

To run it locally, you must install this package as stand-alone project with dev-dependencies.

Then, run web-server from the package directory with the following command:

```
composer serve

```

This command uses web-server bundled with PHP.

Now, open  in the browser (for Windows users it will be opened automatically after starting web-server).

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

[](#documentation)

- [Grids Cookbook](https://github.com/view-components/grids/blob/master/doc/cookbook.md)
- [ViewComponents / Components Overview](https://github.com/view-components/view-components/blob/master/doc/components.md)
- [ViewComponents / Cookbook](https://github.com/view-components/view-components/blob/master/doc/cookbook.md)

Testing
-------

[](#testing)

This application bundled with unit and acceptance tests created with PHPUnit.

To run tests locally, you must install this package as stand-alone project with dev-dependencies.

Command for running unit and acceptance tests:

```
composer test
```

Command for checking code style:

```
composer cs
```

Contributing
------------

[](#contributing)

Please see [Contributing Guidelines](contributing.md) and [Code of Conduct](code_of_conduct.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

© 2015—2016 Vitalii Stepanenko

Licensed under the MIT License.

Please see [License File](LICENSE) for more information.

###  Health Score

31

↑

LowBetter than 71% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.2% 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 ~92 days

Recently: every ~442 days

Total

23

Last Release

1719d ago

PHP version history (3 changes)v0.1.0PHP &gt;=5.5.0

v0.4.2PHP ^5.5||^7

v0.5.10PHP ^5.5||^7||^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/f774898eb3341eff33d07e1b05bccfb69d084831b7ac151d3079e322d0ff6155?d=identicon)[nayjest](/maintainers/nayjest)

---

Top Contributors

[![Nayjest](https://avatars.githubusercontent.com/u/153999?v=4)](https://github.com/Nayjest "Nayjest (209 commits)")[![hexusdev](https://avatars.githubusercontent.com/u/8880373?v=4)](https://github.com/hexusdev "hexusdev (3 commits)")[![bretto36](https://avatars.githubusercontent.com/u/6217994?v=4)](https://github.com/bretto36 "bretto36 (1 commits)")[![globotech-acc](https://avatars.githubusercontent.com/u/10062496?v=4)](https://github.com/globotech-acc "globotech-acc (1 commits)")[![sanasol](https://avatars.githubusercontent.com/u/1709666?v=4)](https://github.com/sanasol "sanasol (1 commits)")

### Embed Badge

![Health badge](/badges/presentation-grids/health.svg)

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

###  Alternatives

[view-components/grids

Flexible Framework-agnostic Data Grids for PHP

8687.8k2](/packages/view-components-grids)[opengento/module-gdpr

Gdpr Compliance Module for Magento 2

14379.8k](/packages/opengento-module-gdpr)[redot/laravel-toastify

A simple package to use toastify.js in laravel applications

109.5k](/packages/redot-laravel-toastify)

PHPackages © 2026

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