Download the PHP package gbrock/laravel-table without Composer

On this page you can find all versions of the php package gbrock/laravel-table. 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-table

Laravel Tables

Made for Laravel 5 Latest Tag

This package contains flexible ways of rendering Eloquent collections as dynamic HTML tables. This includes techniques for sortable columns, customizable cell data, automatic pagination, ~~user-definable rows-per-page, batch action handling, and extensible filtering~~ (coming soon).

Installation

Require the package in your composer.json:

Add the service provider to config/app.php and, optionally, the Facade:

Publish the views and config:

Usage

In order to render an HTML table of Eloquent models into a view, first create a Table object, passing in your model collection (this could be done in your controller, repository, or any service class):

Then pass that object to your view:

In your view, the table object can be rendered using its render function:

Which would render something like this:

Basic example

Sorting

To add links in your headers which sort the indicated column, add the Sortable trait to your model. Since no fields are allowed to be sorted by default (for security reasons), also add a sortable array containing allowed fields.

This adds the sortable scope to your model, which you should use when retrieving rows. Altering our example, $rows = User::get() becomes:

Now, our table will be rendered with links in the header:

Sortable example

The links will contain query strings like ?sort=username&direction=asc.

Pagination

If you paginate your Eloquent collection, it will automatically be rendered below the table:

Customization

Columns

Pass in a second argument to your database call / Table creation, columns:

Cells

You can specify a closure to use when rendering cell data when adding the column:

Also, since the table is accessing our model's attributes, we can add or modify any column key we'd like by using accessors:

The default view favors the rendered_foobar attribute, if present, otherwise it uses the foobar attribute.

View

A copy of the view file is located in /resources/vendor/gbrock/tables/ after you've run php artisan vendor:publish. You can copy this file wherever you'd like and alter it, then tell your table to use the new view:


All versions of laravel-table with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
laravel/framework Version 5.*
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 gbrock/laravel-table contains the following files

Loading the files please wait ....