Download the PHP package nayjest/grids without Composer
On this page you can find all versions of the php package nayjest/grids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nayjest/grids
More information about nayjest/grids
Files in nayjest/grids
Informations about the package grids
Grids
Data Grids Framework for Laravel
All Laravel versions starting from Laravel 4.X are supported.
Features
- Data providers (php array, Eloquent model, Doctrine DBAL query object)
- Themes support
- Individual views for UI components
- Twitter Bootstrap v3 used by default
- Caching
- Smart input handling allows to avoid conflicts with get parameters & easily place few interactive grids on same page
- Rich customization facilities
- Component architecture
- Declarative approach
- Constructing grids via strict object oriented API or configuration in php arrays
- Rich variety of components:
- Excel and CSV export
- Records per page dropdown
- Show/hide columns UI control
- Sorting
- Filtering
- Totals calculation (sum, average value, records count, etc)
- Pagination
- etc
Upcoming Features (moved to view-components/grids)
- Autodetecting columns based on Eloquent model (if not specified)
- Builtin output formatters for different column types
- Working with json data sources via ajax
- Check compatibility with Lumen microframework
Requirements
- Laravel 4.X+
- laravelcollective/html package if you use Laravel5.X
- php 5.5+
Installation
Step 1: Install package using Composer
Add nayjest/grids to "require" section of your composer.json
For Laravel 5 you also need to add "laravelcollective/html":
Then install dependencies using following command:
Instead of editing composer.json and executing composer install you can just run following command:
For Laravel 4
For Laravel 5 / Laravel 6
Step 2: Laravel Setup
Add following line to 'providers' section of app/config/app.php file:
For Laravel 5 / 6 you also need to add "illuminate/html" service provider:
You may also add facade aliases to your application configuration:
Demo
Demonstration available here
Usage
Basic example
In example below grid is configured by php array using Nayjest/Builder package facilities.
Results available here. For more details see demo application repository
Advanced example
If you don't like plain arrays, you can construct grids using object oriented api:
Step 1. Instantiate & Configure Grid
See example below
Step 2. Render Grid
Notes
- Class names in example code used without namespaces therefore you must import it before
-
Grids does not includes Twitter Bootstrap css/js files to your layout. You need to do it manually Quick links:
- Nayjest\Grids\Components\Pager component works only with Laravel 4.X, for Laravel 5 / 6 use Nayjest\Grids\Components\Laravel5\Pager
Working with related Eloquent models
If you need to render data from related Eloquent models, the recommendation is to use joins instead of fetching data from related models becouse in this case filters/sorting will not work. Grids sorting and filters changes Laravel query object, but Laravel makes additional queries to get data for related models, so it's impossible to use filters/sorting with related models.
Following example demonstrates, how to construct grid that displays data from Customer model and related Country model.
Upgrade Guide
From 1.X to 2.X
There are full backward compatibility between 1.X and 2.X branches.
From 0.9.X to 1.X
There are full backward compatibility between 0.9.X and 1.X branches.
From 0.8.X to 0.9.X
Grids starting from v 0.9.0 uses "laravelcollective\html" instead of outdated "illuminate\html".
You may continue to use illuminate\html, but it's recommended to replace it to laravelcollective\html.
-
Replace illuminate\html to laravelcollective\html in composer.json
-
Replace class aliases section in config/app.php ('Illuminate\Html\HtmlFacade' to 'Collective\Html\FormFacade' and 'Illuminate\Html\HtmlFacade' to 'Collective\Html\HtmlFacade')
-
Replace 'Illuminate\Html\HtmlServiceProvider' to 'Collective\Html\HtmlServiceProvider'
- Run composer update
From 0.3.X to 0.4.X
- Use THead & TFoot instead of Header & Footer components
- If you have customized grid view (grid.php), refactor it using changes in default view
- Some components became default, so you don't need to add it to configuration
Default components hierarchy:
For adding child components to default one, resolve it by name and use addComponent / addComponents methods.
Example:
Note that setComponents method rewrites components structure provided by defaults.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
© 2014—2024 Vitalii Stepanenko
Licensed under the MIT License.
Please see License File for more information.