PHPackages                             rafwell/laravel-simplegrid - 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. [Database &amp; ORM](/categories/database)
4. /
5. rafwell/laravel-simplegrid

ActiveLibrary[Database &amp; ORM](/categories/database)

rafwell/laravel-simplegrid
==========================

A simple component for generating powerful grids with Laravel.

3.3.5(1w ago)363.0k↓36.1%10MITJavaScriptPHP &gt;=8.0CI failing

Since Mar 1Pushed 3w ago8 watchersCompare

[ Source](https://github.com/rafwell/laravel-simplegrid)[ Packagist](https://packagist.org/packages/rafwell/laravel-simplegrid)[ RSS](/packages/rafwell-laravel-simplegrid/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (9)Versions (103)Used By (0)

About this project
------------------

[](#about-this-project)

**rafwell/laravel-simplegrid** is a component for build powerful grids, with less code. The component is ready to work with Bootstrap 3, have features to export to xls, csv and pdf, simple/advanced search, ordenation, actions inline or bulk.

Compatibility
-------------

[](#compatibility)

**rafwell/laravel-simplegrid** is compatibly with Laravel 5.2+

Instalation
-----------

[](#instalation)

1. Add the dependency to your composer.json `composer require "rafwell/laravel-simplegrid"` or `"rafwell/laravel-simplegrid": "^2.0"`.
2. Execute `composer update`.
3. Add to your `config/app.php` our service provider: `Rafwell\Simplegrid\SimplegridServiceProvider::class`
4. Execute `php artisan vendor:publish --provider="Rafwell\Simplegrid\SimplegridServiceProvider"`
5. Include in your html the js and css dependencies.

### Dependencies

[](#dependencies)

This package was written to work with bootstrap 3 and Jquery. We need the following dependencies:

- [Datetimepicker](https://eonasdan.github.io/bootstrap-datetimepicker/), for advanced search in date and datetime fields.
- [Moment](https://github.com/moment/moment), for Datetimepicker work.

Properly we added to our package those dependencies. You can add this from your `public/vendor/rafwell/simple-grid`, like that:

#### CSS Files

[](#css-files)

```

```

#### JS Files

[](#js-files)

```

```

An simple example
-----------------

[](#an-simple-example)

In your controller:

```
use Rafwell\Simplegrid\Grid;
```

In your function:

```
$Grid = new Grid(Employe::query(), 'Employes');

$Grid->fields([
  'birth_date'=>'Birthday',
  'first_name'=>'First Name',
  'last_name'=>'Last Name',
  'gender'=>[
          'label'=>'Gender',
          'field'=>"case when gender = 'M' then 'Male' else 'Female' end"
      ]
]);
return view('yourview', ['grid'=>$Grid]);
```

In your view:

```
{!!$grid->make()!!}
```

The result will be like this: [![Simple grid](https://camo.githubusercontent.com/fdea75dd8961fa248ad4ad8655565503c3083d7b0ca237053ef14e193de68066/687474703a2f2f692e696d6775722e636f6d2f583569646e66692e706e67)](https://camo.githubusercontent.com/fdea75dd8961fa248ad4ad8655565503c3083d7b0ca237053ef14e193de68066/687474703a2f2f692e696d6775722e636f6d2f583569646e66692e706e67)

A more complex example
----------------------

[](#a-more-complex-example)

Change the code of your controller to:

```
$Grid->fields([
    'birth_date'=>'Birthday',
    'first_name'=>'First Name',
    'last_name'=>'Last Name',
    'gender'=>[
        'label'=>'Gender',
        'field'=>"case when gender = 'M' then 'Male' else 'Female' end"
    ]
])
->actionFields([
    'emp_no' //The fields used for process actions. those not are showed
])
->advancedSearch([
    'birth_date'=>['type'=>'date','label'=>'Birthday'],
    'first_name'=>'First Name', // It's a shortcut for ['type'=>'text', 'label'=>'First Name'],
    'last_name'=>[
        //omiting the label. I'ts a shortcut, like above
        'type'=>'text',
        'sanitize'=>false //This field will not be sanitized
    ],
    'gender'=>[
        'type'=>'select',
        'label'=>'Gender',
        'options'=>['Male'=>'Male', 'Female'=>'Female'] //The key is the value of option
    ]
]);

$Grid->action('Edit', 'test/edit/{emp_no}')
->action('Delete', 'test/{emp_no}', [
    'confirm'=>'Do you with so continue?',
    'method'=>'DELETE',
]);

$Grid->checkbox(true, 'emp_no');
$Grid->bulkAction('Delete selected itens', '/test/bulk-delete');
```

The result will be like this: [![Complex grid](https://camo.githubusercontent.com/b84425951c3e74194663043348c5b739d24cd65a1fea1c371be507800107fdab/68747470733a2f2f696d6167652e6962622e636f2f6a79693461612f436170747572615f64655f74656c615f64655f323031375f30335f30315f31355f31325f30352e706e67)](https://camo.githubusercontent.com/b84425951c3e74194663043348c5b739d24cd65a1fea1c371be507800107fdab/68747470733a2f2f696d6167652e6962622e636f2f6a79693461612f436170747572615f64655f74656c615f64655f323031375f30335f30315f31355f31325f30352e706e67)The advanced search allow you search field by field. The rendered is like this: [![Complex grid advanced search](https://camo.githubusercontent.com/196f2f645f1f29f5b4051fc8982eec2c28808fb42a16c07e12a008472538e89f/68747470733a2f2f696d6167652e6962622e636f2f6d76455376612f436170747572615f64655f74656c615f64655f323031375f30335f30315f31355f31345f30332e706e67)](https://camo.githubusercontent.com/196f2f645f1f29f5b4051fc8982eec2c28808fb42a16c07e12a008472538e89f/68747470733a2f2f696d6167652e6962622e636f2f6d76455376612f436170747572615f64655f74656c615f64655f323031375f30335f30315f31355f31345f30332e706e67)

#### Your model has relationships? Try it:

[](#your-model-has-relationships-try-it)

```
//Make your query using eloquent orm normally
$Employe = Employe::join('supervisors', 'supervisors.id','=','employees.supervisor_id');

$Grid = new Grid($Employe, 'Employes');

//Here, the key or array of fields is the name of the field. so, you can concatenate with the table name
//You can make sub queries too
$Grid->fields([
    'birth_date'=>'Birthday', //If you not explicit the name of table, we use the principal table of query builded. in this case, employees's
    'first_name'=>'First Name',
    'last_name'=>'Last Name',
    'gender'=>[
        'label'=>'Gender',
        'field'=>"case when gender = 'M' then 'Male' else 'Female' end" //This is a calculated field too
    ],
    'supervisors.name'=>'Supervisor Name', //There the example with relationship
    'virtual_field'=>[
        'label'=>'My first virtual field',
        'field'=>'(select column from table where...)' //Obviously, this subquery must return only 1 row
    ]
]);
//Continue code...
//Easier than that? :)
```

#### Mutators

[](#mutators)

All mutators *get* of the principal table will work normally when the renderer called. For personalize or trait an line before show, for make an visual concatenate or formatter, you can use the `processLine` method:

```
$Grid->fields([
  'birth_date'=>'Birthday',
  'first_name'=>'First Name',
  'last_name'=>'Last Name',
  'gender'=>'Gender'
])
->processLine(function($row){
    //This function will be called for each row
    $row['gender'] = $row['gender'] == 'M' ? 'Male' : 'Female';
    //Do more you need on this row
    return $row; //Do not forget to return the row
});
```

In some case, some actions cannot be called. For example, if you cannot allow edit button if the status is equal 2:

```
$Grid->fields([
  'birth_date'=>'Birthday',
  'first_name'=>'First Name',
  'last_name'=>'Last Name',
  'gender'=>'Gender',
  'status'=>'Status'//It's a integer on database. If 2 not allowed edit
])
>action('Edit', 'test/edit/{emp_no}')
->processLine(function($row){
    //This function will be called for each row
    if($row['status']==2)
        unset($row['gridActions']['edit']);
    //Do more you need on this row
    return $row; //Do not forget to return the row
});
//Awesome!
```

Extra Configurations
--------------------

[](#extra-configurations)

After you publish the our service provider, will apear in your config folder a file named `rafwell-simplegrid.php`. In him, you can change the standard of date and datetime fields of advanced search, the initial value of 'showing x rows per page' and more!

Language
--------

[](#language)

This package is multi-language. We use the location of you laravel instalattion, configured in your `config/app.php`. If we have the translation this will be automatically loaded. You can see the currently supported languages in our [lang folder](resources/lang).

Disclaimer
----------

[](#disclaimer)

This repository is new, 'forked' from [rafwell/laravel-grid](https://github.com/rafwell/laravel-grid). The original repository does not contemple multi-language features. It has been discontinued in favor of this.

Contribute
----------

[](#contribute)

If you want contribute, you can open issues to discussion.

License
-------

[](#license)

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

Breakingchanges log
-------------------

[](#breakingchanges-log)

- Since the version 2.0 we have added an [html-sanitizer](https://github.com/tgalopin/html-sanitizer) by default. This can break your code if you are showing some specific html entities in your grid. Note thatn on the version 1 was your responsability prevent that. If you are not sanitizing your data before renderi it, they can be unsafe, you can be vulnerable to attacks XSS. We highly recommend all you to update to the version 2.0, the default tags allowed is very common, rarely will affect your code.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance96

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.7% 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 ~34 days

Total

101

Last Release

13d ago

Major Versions

1.19.0 → 2.20.02021-08-09

1.19.1 → 2.21.12021-09-09

1.19.2 → 2.22.02022-10-17

2.25.1 → 3.0.02024-01-12

2.25.2 → 3.0.12024-05-31

PHP version history (2 changes)2.0.0PHP &gt;=7.1.0

3.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![rafwell](https://avatars.githubusercontent.com/u/2893078?v=4)](https://github.com/rafwell "rafwell (135 commits)")[![iagosr](https://avatars.githubusercontent.com/u/20777098?v=4)](https://github.com/iagosr "iagosr (5 commits)")[![grayboxpdx](https://avatars.githubusercontent.com/u/8332666?v=4)](https://github.com/grayboxpdx "grayboxpdx (1 commits)")

---

Tags

data-grideloquentgridgrid-bootstraplaravellaravel-easygridlaravel-gridmulti-language

### Embed Badge

![Health badge](/badges/rafwell-laravel-simplegrid/health.svg)

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

###  Alternatives

[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[cyber-duck/laravel-excel

This package provides a way to export an Eloquent collection as an excel file and to import a Excel file as an Eloquent collection.

74230.7k](/packages/cyber-duck-laravel-excel)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[jormin/laravel-ddoc

每次开发项目时，总是会被要求提供数据字典，每次手动写文档太累了，所以写了这个扩展，自动读取数据库信息并显示在网页上，支持导出Html和PDF文件。

1567.5k](/packages/jormin-laravel-ddoc)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2920.0k](/packages/voku-session2db)

PHPackages © 2026

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