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

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

adiliogobira/laravel-datagrid
=============================

Laravel integration for Grid.js server side processing

0.2.0(4y ago)08MITPHPPHP &gt;=7.4

Since Mar 23Pushed 4y agoCompare

[ Source](https://github.com/adiliogobira/laravel-datagrid)[ Packagist](https://packagist.org/packages/adiliogobira/laravel-datagrid)[ Docs](https://github.com/wdev-rs/laravel-datagrid)[ RSS](/packages/adiliogobira-laravel-datagrid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Laravel integration for the Grid.js
===================================

[](#laravel-integration-for-the-gridjs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2ef662335173ecb07eec25a834d8368bd27a712a885f2a89af2afb46c5bcb35e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776465762d72732f6c61726176656c2d64617461677269642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wdev-rs/laravel-datagrid)[![Build Status](https://github.com/wdev-rs/laravel-datagrid/actions/workflows/test.yml/badge.svg)](https://github.com/wdev-rs/laravel-datagrid/actions/workflows/test.yml)[![Quality Score](https://camo.githubusercontent.com/eaa8acd445033c143d4301d2785a25cb7ec08805806e069123e32f444f5e111c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776465762d72732f6c61726176656c2d64617461677269642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/wdev-rs/laravel-datagrid)[![Total Downloads](https://camo.githubusercontent.com/7532c279450c7477e6155ea1bbecc70ce9300613895d529cea1f8d75fc11af03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776465762d72732f6c61726176656c2d64617461677269642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wdev-rs/laravel-datagrid)

This package is a Laravel integration for the [Grid.js](https://gridjs.io/). The packages makes it easy to create data-grid for your Laravel application, for example admin panel lists. It covers the basic server side functionalities for Grid.js like search, sorting and pagination.

[![Laravel DataGrid](https://raw.githubusercontent.com/wdev-rs/laravel-datagrid/master/resources/img/laravel-datagrid.png)](https://raw.githubusercontent.com/wdev-rs/laravel-datagrid/master/resources/img/laravel-datagrid.png)

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

[](#installation)

You can install the package via composer:

```
composer require wdev-rs/laravel-datagrid
```

Install the Vue.js integration:

```
npm install gridjs-vue
```

Publish the vendor files by running

```
php artisan vendor:publish --provider="WdevRs\LaravelDatagrid\LaravelDatagridServiceProvider"
```

Register the DataGrid fronted Vue.js component by adding the following line to your `app.js`:

```
require('./vendor/laravel-datagrid/laravel-datagrid');
```

Usage
-----

[](#usage)

The base of this package is the `\WdevRs\LaravelDatagrid\DataGrid\DataGrid` class. This class is used to define the columns and the behavior of the datagrid. While you can use this class directly from the controller, I'll suggest extending it and create separate classes for each datagrid.

```
class CategoriesDataGrid extends DataGrid
{

    /**
     * CategoriesDataGrid constructor.
     */
    public function __construct()
    {
        $this->query(Category::query())
            ->column('id', 'ID', null, 50)
            ->column('name', 'Name', function ($category) {
                return view('admin.categories.actions.edit_link', ['category' => $category])->render();
            })
    }
}
```

Using the `query` method you can define what should be the base query for the DataGrid. It accepts a Laravel Query Builder object. The `column` method is used to define the columns of the DataGrid, the argument are as follows:

- `id` - the name of the field in the database
- `name` - the label which should appear in the DataGrid column header
- `formatter` - optional, callable allows you to format the display of the column. As you can see from the above example probably the most elegant way to do this is to include a blade view and render it.
- `width` - optional, the with of the column

When the DataGrid definition is ready, you can add it to the controller:

```
    public function index(CategoriesDataGrid $dataGrid, Request $request)
    {
        return $dataGrid->render();
    }
```

If the `render` method is called without arguments it will use the default view `resources/views/vendor/laravel-datagrid/datagrid.blade.php`, or you can pass your own view and include the DataGrid blade file there:

```
    public function index(CategoriesDataGrid $dataGrid, Request $request)
    {
        return $dataGrid->render('admin.common.index');
    }
```

Frontend customisations
-----------------------

[](#frontend-customisations)

The frontend component of the DataGrid can be found in the `resources/js/vendor/laravel-datagrid/components/DataGrid.vue`By default DataGrid comes with one row action, which is the delete action. This action can be found in the following file: `resources/js/vendor/laravel-datagrid/actions/delete.js`

You can extend it with more custom actions by creating them based on the existing one. To add the to the datagrid, extend the `cols` definition in the `DataGrid.vue`:

```
            cols: this.columns.map((col) => {col.formatter = (cell) => html(cell); return col;}).concat(
                [{
                    name: 'Actions',
                    sort: false,
                    width: 50,
                    formatter: (cell, row) => {
                        return h('div', {className: "text-center"},
                            deleteAction.call(this, row.cells[0].data,row.cells[1].data),
                            yourCustomAction.call(this, row.cells[0].data,row.cells[1].data)
                        )
                    }
                }]
            )
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Daniel Werner](https://github.com/wdev-rs)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.6% 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 ~65 days

Total

2

Last Release

1811d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.2.0PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![daniel-werner](https://avatars.githubusercontent.com/u/38726367?v=4)](https://github.com/daniel-werner "daniel-werner (25 commits)")[![adiliogobira](https://avatars.githubusercontent.com/u/3763290?v=4)](https://github.com/adiliogobira "adiliogobira (1 commits)")[![Max-Hutschenreiter](https://avatars.githubusercontent.com/u/8393676?v=4)](https://github.com/Max-Hutschenreiter "Max-Hutschenreiter (1 commits)")

---

Tags

wdev-rslaravel-datagrid

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[wdev-rs/laravel-datagrid

Laravel integration for Grid.js server side processing

548.4k](/packages/wdev-rs-laravel-datagrid)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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