PHPackages                             amjadiqbal/laravel-gridjs - 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. amjadiqbal/laravel-gridjs

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

amjadiqbal/laravel-gridjs
=========================

The modern, dependency-free Datagrid for Laravel. A powerful Grid.js wrapper with Eloquent support, server-side pagination, and an elegant fluent API.

00PHP

Since Feb 23Pushed 4mo agoCompare

[ Source](https://github.com/amjadiqbal/laravel-gridjs)[ Packagist](https://packagist.org/packages/amjadiqbal/laravel-gridjs)[ RSS](/packages/amjadiqbal-laravel-gridjs/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

 [![Laravel Grid.js Banner](assets/laravel-grid.png)](assets/laravel-grid.png)

 [![Packagist](https://camo.githubusercontent.com/df2087024766c19becafed748e2a01f94a4c0febcf0ad7c8ad649af43d3c3a50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d6a6164697162616c2f6c61726176656c2d677269646a732e7376673f636f6c6f723d303037656336)](https://packagist.org/packages/amjadiqbal/laravel-gridjs) [![Downloads](https://camo.githubusercontent.com/a72f96d661a6fe97f52e1283018dfc9c56937a997fc417f2a0a3cedafba5058b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d6a6164697162616c2f6c61726176656c2d677269646a732e7376673f636f6c6f723d343361303437)](https://packagist.org/packages/amjadiqbal/laravel-gridjs) [![CI](https://camo.githubusercontent.com/926346c0962a54bdc4708930e8961c94fe62130a1a9c7245988bcd76469fc651/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616d6a6164697162616c2f6c61726176656c2d677269646a732f74657374732e796d6c3f6c6162656c3d746573747326636f6c6f723d306434376131)](https://github.com/amjadiqbal/laravel-gridjs/actions) [![License](https://camo.githubusercontent.com/22b45648be9e6156ec9555ff3458ff3e3baf7fb31f8c6fe8787fd3c0febd9c6b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3463616635302e737667)](https://github.com/amjadiqbal/laravel-gridjs) [![Stars](https://camo.githubusercontent.com/572d855e7d946a86d32a0332ab029c74049e9ab75154f83300f4486a2a13f640/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616d6a6164697162616c2f6c61726176656c2d677269646a733f636f6c6f723d666662333030267374796c653d736f6369616c)](https://github.com/amjadiqbal/laravel-gridjs) [![Forks](https://camo.githubusercontent.com/837924359f388aaf1eae9e54d9e2ebd28bfea49ef29190b51b843017213de2d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f616d6a6164697162616c2f6c61726176656c2d677269646a733f636f6c6f723d396539643234267374796c653d736f6369616c)](https://github.com/amjadiqbal/laravel-gridjs) [![PHP Version](https://camo.githubusercontent.com/136fb42bb7c3006a89b06847c50a6c6b7867b12b806c1dab5ab87af33134901f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d3737376262332e737667)](https://php.net) [![Laravel](https://camo.githubusercontent.com/2cb797e6da5191686d8e52284a168531834b915bf65504974c51f55559b0bb4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313025323025374325323031312d6666326432302e737667)](https://laravel.com) [![Coverage](https://camo.githubusercontent.com/b766f2c5a68ff26fb58a6f9c991025a9c7d8e20ff760247a85001b67b8dc3687/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f616d6a6164697162616c2f6c61726176656c2d677269646a733f636f6c6f723d316538386535)](https://codecov.io/gh/amjadiqbal/laravel-gridjs) [![Open Issues](https://camo.githubusercontent.com/22a677050d14fbea9e0bf5118a36ad7c61a8efb8df83f57fd55f1c274f2744bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616d6a6164697162616c2f6c61726176656c2d677269646a732e7376673f636f6c6f723d643831623630)](https://github.com/amjadiqbal/laravel-gridjs/issues) [![PRs](https://camo.githubusercontent.com/e0e59a6da8931febaa2519249421c492fb4ac307efcc2382c3bd43e47d8b8a19/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f616d6a6164697162616c2f6c61726176656c2d677269646a732e7376673f636f6c6f723d386532346161)](https://github.com/amjadiqbal/laravel-gridjs/pulls)

Laravel Grid.js
===============

[](#laravel-gridjs)

The modern, dependency-free Datagrid for Laravel. A powerful Grid.js wrapper with Eloquent support, server-side pagination, and an elegant fluent API.

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

[](#table-of-contents)

- Why Grid.js?
- Installation
- Quick Start
- Visual Examples
- Server-side JSON Schema
- Fluent API Reference
- Configuration
- Development
- Changelog
- Contributing

Why Grid.js?
------------

[](#why-gridjs)

- No jQuery
- Tiny footprint (Grid.js UMD)
- Native Laravel integration (Eloquent + routes)
- Fluent, chainable API
- Server-side ready (search, sort, paginate)

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

[](#installation)

```
composer require amjadiqbal/laravel-gridjs
```

### Installation Wizard (Interactive)

[](#installation-wizard-interactive)

- Run the installer to set defaults and optionally publish assets:

```
php artisan gridjs:install
```

- Prompts:

    - Route prefix (default: gridjs)
    - Use CDN or local assets
    - Publish local assets and path
    - Open contact page in browser
- Non-interactive usage:

```
php artisan gridjs:install \
  --prefix=datagrid \
  --cdn=false \
  --publish-assets=true \
  --assets-path=public/vendor/gridjs \
  --open-link=false \
  --contact-url=https://github.com/amjadiqbal/laravel-gridjs/issues
```

### Publish Assets Locally

[](#publish-assets-locally)

```
php artisan gridjs:publish-assets --path=public/vendor/gridjs
```

Quick Start
-----------

[](#quick-start)

```
use AmjadIqbal\GridJS\Facades\Grid;
use App\Models\User;

echo Grid::fromQuery(User::query())
    ->columns(['id', 'name', 'email'])
    ->searchable()
    ->sortable()
    ->pagination(10)
    ->theme('mermaid')
    ->render();
```

Visual Examples
---------------

[](#visual-examples)

### Minimal Users Table

[](#minimal-users-table)

```
use AmjadIqbal\GridJS\Facades\Grid;
use App\Models\User;

echo Grid::fromQuery(User::query())
    ->columns(['id', 'name', 'email'])
    ->pagination(15)
    ->render();
```

### Skeleton Theme + Fixed Header + Resizable

[](#skeleton-theme--fixed-header--resizable)

```
echo Grid::fromQuery(User::query())
    ->columns(['id', 'name', 'email'])
    ->searchable()
    ->sortable()
    ->pagination(20)
    ->resizable()
    ->fixedHeader()
    ->theme('skeleton')
    ->render();
```

### Custom ClassName Theme

[](#custom-classname-theme)

```
echo Grid::fromQuery(User::query())
    ->columns(['id', 'name', 'email'])
    ->theme([
        'table' => 'w-full border border-slate-200 rounded-md',
        'thead' => 'bg-slate-50',
        'th'    => 'px-3 py-2 text-xs text-slate-600',
        'td'    => 'px-3 py-2 text-sm text-slate-800',
    ])
    ->render();
```

### Column Formatters

[](#column-formatters)

```
echo Grid::fromQuery(User::query())
    ->columns([
        ['field' => 'id', 'name' => 'ID'],
        ['field' => 'email', 'name' => 'Email', 'formatter' => 'cell => cell.toUpperCase()'],
    ])
    ->render();
```

### Built-in Format Options

[](#built-in-format-options)

```
// Date
echo Grid::fromQuery(User::query())
    ->columns([
        ['field' => 'created_at', 'name' => 'Joined', 'format' => ['type' => 'date', 'locale' => 'en-US']],
    ])
    ->render();

// Currency
echo Grid::fromQuery(User::query())
    ->columns([
        ['field' => 'balance', 'name' => 'Balance', 'format' => ['type' => 'currency', 'currency' => 'USD']],
    ])
    ->render();

// Link
echo Grid::fromQuery(User::query())
    ->columns([
        ['field' => 'email', 'name' => 'Email', 'format' => ['type' => 'link']],
    ])
    ->render();
```

### Actions Column

[](#actions-column)

```
echo Grid::fromQuery(User::query())
    ->columns([['field' => 'id', 'name' => 'ID'], 'name', 'email'])
    ->actions([
        ['label' => 'View', 'baseUrl' => '/users', 'class' => 'btn btn-sm'],
        ['label' => 'Edit', 'baseUrl' => '/users/edit', 'class' => 'btn btn-sm btn-warning'],
    ], idIndex: 0)
    ->render();
```

### Asset Options

[](#asset-options)

- Configurable CDN injection via `config/gridjs.php`:

```
return [
  'assets' => [
    'cdn' => true,
    'script' => 'https://unpkg.com/gridjs/dist/gridjs.umd.js',
    'themes' => [
      'mermaid' => 'https://unpkg.com/gridjs/dist/theme/mermaid.min.css',
      'skeleton' => 'https://unpkg.com/gridjs/dist/theme/skeleton.min.css',
    ],
  ],
];
```

### Custom Route Prefix

[](#custom-route-prefix)

```
// config/gridjs.php
return ['prefix' => 'datagrid'];
```

Server-side JSON Schema
-----------------------

[](#server-side-json-schema)

- Endpoint: `GET /{prefix}/data` (default: `/gridjs/data`)
- Query params:
    - `model`: FQCN of the Eloquent model
    - `columns`: comma-separated list of fields
    - `limit`: page size (int)
    - `page`: page number (int)
    - `search`: search string (optional)
    - `sort`: column name (optional)
    - `direction`: `asc` or `desc` (optional)
- Response:

```
{
  "data": [
    ["1", "Alice", "alice@example.com"],
    ["2", "Bob", "bob@example.com"]
  ],
  "total": 42
}
```

Fluent API Reference
--------------------

[](#fluent-api-reference)

MethodParamsReturnsNotescolumnsarray $columnsselfDefines visible fields and server serialization ordersortablebool $enabled = trueselfEnables Grid.js sort and maps to server `sort/direction`searchablebool $enabled = trueselfEnables Grid.js search and maps to server `search`paginationint $limitselfEnables pagination and sets `limit`; server uses `page`resizablebool $enabled = trueselfEnables Grid.js column resizingfixedHeaderbool $enabled = trueselfEnables Grid.js fixed header renderingthemestringarray $themeselffromQueryBuilder $queryGridBuilderBinds an Eloquent model to server routerender—HtmlStringReturns HTML/JS for Grid.js initializationConfiguration
-------------

[](#configuration)

- File: `config/gridjs.php`
- Options:
    - `prefix`: Route segment for the data endpoint (default: `gridjs`)

Development
-----------

[](#development)

- Testing:

```
vendor/bin/pest
```

- Installer:

    - The installer prints a general contact message:
        - “If you are facing any issue or need development help, contact me: [https://github.com/amjadiqbal/laravel-gridjs/issues”](https://github.com/amjadiqbal/laravel-gridjs/issues%E2%80%9D)
    - You can pass a custom contact URL with `--contact-url`
    - Opening the contact page is optional via `--open-link` or prompt
- Local Assets:

    - Banner stored in `assets/banner.svg` and included in README

Changelog
---------

[](#changelog)

- See GitHub releases for a full changelog.

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

[](#contributing)

- Fork and create a feature branch
- Add tests for your changes
- Open a PR with a clear description and rationale

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance52

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![amjadiqbal](https://avatars.githubusercontent.com/u/36040604?v=4)](https://github.com/amjadiqbal "amjadiqbal (5 commits)")

### Embed Badge

![Health badge](/badges/amjadiqbal-laravel-gridjs/health.svg)

```
[![Health](https://phpackages.com/badges/amjadiqbal-laravel-gridjs/health.svg)](https://phpackages.com/packages/amjadiqbal-laravel-gridjs)
```

###  Alternatives

[spomky-labs/cbor-php

CBOR Encoder/Decoder for PHP

5811.7M43](/packages/spomky-labs-cbor-php)[scribu/scb-framework

A set of useful classes for faster plugin development

22393.7k](/packages/scribu-scb-framework)

PHPackages © 2026

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