Download the PHP package apphp/laravel-datagrid without Composer

On this page you can find all versions of the php package apphp/laravel-datagrid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-datagrid

License: MIT

DataGrid helpers for Laravel Framework Applications

This package helps to create DataGrid (CRUD) pages for Laravel 6+ framework applications.

Requirements

License

This project is released under the MIT License.
Copyright © 2020 ApPHP.

Installation

Begin by pulling in the package through Composer.

Next, make sure you connected Bootstrap. You may either pull in the Bootstrap's CSS within your HTML or layout file, or write your own CSS classes based on them.

If you need to modify the datagrid files, you can run:

Usage in Controllers

1. Import classes

2. Define filters and filter field types

Following filter field types are available

Type Description
string Any type of strings
integer or int Numeric integer field (HTML type="number" attribute is used)
set Set of values (array)
date The datetime fields

Each filter field can include following attributes:

Attribute Type Description
title String Specifies a title, that will be shown in the label of filter field
type String Specifies a type of the filter field (see above)
compareType String Specifies which type of comparison will be used: ex.: '=', '%like%', '!=' etc.
source Array Specifies the source (array) to 'set' fields
validation Array Specifies validation rules (array). Possible options: ['minLength'=>2, 'maxLength'=>10, 'min'=>2, 'max'=>100]
relation String Specifies the relation between 2 models (One-to-One, One-to-Many), ex.: search in posts for users - relation="posts"
relationXref String Specifies the relation between 2 models (Many-to-Many), ex.: search in roles for users - relation="roles"
htmlOptions Array Specifies any possible HTML attribute for the field
disabled Boolean Specifies whether the field is disabled or not (default - not)

3. Handle filters and prepare SQL builder

4. Sorting

5. Pagination

6. Rendering view

Usage in View files

Configuration

To change default settings and enable some extra features you can export the config file:

Localization

To change or add new translation files you can export the language files:

Customize Views

To change HTML template of the datagrid or use your own, publish view file and customize it to suit your needs.

Now you should have a datagrid.php file in the config folder of your application. If you need to force to re-publish the config file to use --force.

Testing

To rum unit testing simply do following:

or your may add additional section to your composer.json file:

and then rum unit following command:

and so on...

Examples

Controller code (full example)

Sorting

If you use some kind of packages for column sorting, like kyslik/column-sortable, you have to change usage of Model to following: Without sorting

With column sorting

Table content rendering

You have 2 way to render table content. The first is to write creating table manually in view file. Look on example below:

The second way is to use GridView helper. Look on example below:

You may also use a callback attribute to customize values of the specific field. This attribute accepts a function, link to function or a closure. Below you may find few examples to get a feel:

Show specific badge if user has verified

Show a list of user roles, get array of roles via $roles parameter

Show user's avatar with a link to edit

Collapsed filter

Collapsed filter

Expanded filter

Expanded filter

Pagination

Pagination


All versions of laravel-datagrid with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
illuminate/support Version ~5.0|^6.0|^7.0|^8.0|^9.0|^10
jenssegers/agent Version ^2.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package apphp/laravel-datagrid contains the following files

Loading the files please wait ....