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(4y ago)358↓100%MITPHPPHP &gt;=7.2

Since Jul 17Pushed 4y 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 today

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 39% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

1818d 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.

718267.0k11](/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.4M36](/packages/in2code-powermail)[yectep/phpspreadsheet-bundle

A Symfony bundle to integrate with PHPOffice's PhpSpreadsheet library

592.3M3](/packages/yectep-phpspreadsheet-bundle)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52658.0k8](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

44732.1k2](/packages/pimcore-data-importer)[terminal42/contao-leads

Leads extension for Contao Open Source CMS; Store and manage form data with ease!

41164.9k8](/packages/terminal42-contao-leads)

PHPackages © 2026

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