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

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lavdiu/php-grid
===============

PHP Grid - Easily create flexible grids in PHP

1.1.0(5y ago)358↓100%MITPHPPHP &gt;=7.2

Since Jul 17Pushed 5y agoCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

PhpGrid
=======

[](#phpgrid)

PHP Grid - simple php class that allows building dynamic grids using PHP and JS

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

This class relies on the following libaries:

- `box/spout` and `phpoffice/phpspreadsheet` to generate Excel exports on the server side
- [SheetJS](https://github.com/sheetjs/sheetjs) to generate Excel/CSV export in the browser.
- [JQuery](https://jquery.com/) and
- [Bootstrap 4](https://getbootstrap.com/)

### Installation

[](#installation)

To install this library use

```
composer require lavdiu/php-grid
```

Copy `grid.js` from `assets/` folder to your assets folder or root of your web directory and include it in your page.

### Usage

[](#usage)

```
require_once __DIR__ . '/../vendor/autoload.php';

use PhpGrid\PhpGrid;
use PhpGrid\Column;
use PhpGrid\ActionButton;

$pdo = new PDO('mysql:host=localhost;dbname=database', 'username', 'password');

$grid = new PhpGrid($pdo, 'contacts_list');
$grid->setTitle('List of all contacts')
    ->setRowsPerPage(10)
    ->setSqlQuery("SELECT id, name, email, created_on FROM contact_list")
    ->addColumn(new Column('id', 'Contact Id', true, true, '?mod=contact&id={id}', '_blank'))
    ->addColumn(new Column('email', 'Email Address'))
    ->addActionButton(new ActionButton('View', '?mod=contact&id={id}', 'fa fa-eye'))
    ->addActionButton(new ActionButton('Update', '?mod=contact&id={id}&action=update', 'fa fa-pencil'));

/**
 * Setting custom attributes to the button
 */
$deleteButton = new ActionButton('Delete', '?mod=contact&id={id}&action=delete', 'fa fa-trash');
$deleteButton->addAttribute('onclick', "return confirm('Are you sure?');");
$grid->addActionButton($deleteButton);

/**
 * Set custom style/classes to the cell itself
 */
$col1 = new Column('name', 'Full Name');
$col1->setOuterElementCssClass('text-center');
$col1->setOuterElementCssStyle('background-color:silver');
$grid->addColumn($col1);

/**
 * Set custom style/classes to the content of the cell
 */
$col2 = new Column('created_on', 'Registration Date', true);
$col2->setInnerElementCssClass('border border-danger');
$col2->setInnerElementCssStyle('color:red;cursor:pointer;');
$grid->addColumn($col2);

$grid->setDebug(true); #output additional debugging info in json responses

if ($grid->isReadyToHandleRequests()) {
    $grid->bootstrap();
}

echo $grid->draw();
```

See [examples](https://github.com/lavdiu/php-grid/tree/master/examples) directory for more examples

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Every ~129 days

Total

3

Last Release

1863d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0842c6aa63f79e09a51c68d025ccde870dbababec7c76601380a13a0a68970a2?d=identicon)[lavdiu](/maintainers/lavdiu)

---

Top Contributors

[![lavdiu](https://avatars.githubusercontent.com/u/3239016?v=4)](https://github.com/lavdiu "lavdiu (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[rafwell/laravel-simplegrid

A simple component for generating powerful grids with Laravel.

362.9k](/packages/rafwell-laravel-simplegrid)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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