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

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

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

A simple component for generating powerful grids with Laravel.

3.3.2(3mo ago)362.9k↓78.6%MITPHP &gt;=8.0

Since Mar 1Compare

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

READMEChangelogDependencies (6)Versions (100)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

54

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

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

Recently: every ~25 days

Total

98

Last Release

103d 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)

### 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)
```

PHPackages © 2026

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