Download the PHP package distilleries/datatable-builder without Composer

On this page you can find all versions of the php package distilleries/datatable-builder. 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 datatable-builder

Scrutinizer Code Quality Code Coverage Build Status Total Downloads Latest Stable Version

Laravel 5 Datatable Builder

Based on chumper/datatable. It's an abstract class to implement the datatable like the form generator.

Table of contents

  1. Installation
  2. Basic usage
  3. Closure
  4. BaseQuery
  5. Filters
  6. Styles
  7. Controller

Installation

Add on your composer.json

run composer update.

Add Service provider to config/app.php:

And Facade (also in config/app.php)

Add the javascript on your bower dependencies:

Export the configuration:

Export the views (optional):

Export the Javascript assets (optional):

Include the javascript with gulp or grunt vendor/distilleries/datatable-builder/resources/**/*. If you don't use a task manager or you want override the javascript just publish those with the command line:

You can find those in resources/assets/vendor/datatable-builder.

Basic usage

Creating form classes is easy. With a simple artisan command I can create a datatable:

you create form class in path app/Datatables/PostDatatable.php that looks like this:

You can add fields which you want when creating command like this:

And that will create a datatable in path app/Datatables/SongDatatable.php with content:

The method add have in param:

add($name, $closure = null, $translation = '', $orderable = true)

Param Usage
name Name of the column
closure Function with the model in parameter to return a template. By default null use the attribute of the model.
translation Translation of the column, by default empty use the column name
orderable Flag to handle column orderable state, by default true

Closure

When you create a datatatable sometime the content need to be get from other table or stylize by a template like the actions buttons.

For example an address is link to a profile. To display the profile name on the datatable like the picture you can use the closure.

On my model Address I have:

datatable

You can return a template if you want:

BaseQuery

You can override the base query for the datatable query.

By default it will send a fresh full Query: $this->model->newModelQuery();

Filters

You can use complex filter to filter your datatable. To do that I use the library FormBuilder. All the datatable have a plain form filter. If you had field on this form that display the filters.

For example we want all the user only online.

I create a choice field:

filters

When the filters are submitted you can apply it with the method applyFilters. By default this method create a where with the name of the filter field if it's an attribute of the model. If you want change this behaviour you can override it.

If you don't want create a global scope of your model you just want restrict the display for this datatable. you can use applyFilters to do that.

For example I want display only the customer of the application: The datable work on the user model.

Styles

You want stylize your row to put it on green, blue or red. You can do that with setClassRow. By default this method check the status attribute. If the status exist and it is empty we add the danger class to display it in red.

Controller

You can use the trait Distilleries\DatatableBuilder\States\DatatableStateTrait to add in your controller the default methods use with the datatable.

Example: I created a controller app/Http/Controllers/DatatableController:

I add the controller on the route file :

Like you can see I inject the model and the datatable on the constructor. On the welcome template I put:

That it you have your datatable from the user model.


All versions of datatable-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
illuminate/support Version 5.8.*
illuminate/view Version 5.8.*
illuminate/filesystem Version 5.8.*
distilleries/datatable Version 3.1.*
distilleries/form-builder Version 2.13.*
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 distilleries/datatable-builder contains the following files

Loading the files please wait ....