Download the PHP package rogercbe/table-sorter without Composer

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

Laravel Table Sorter

This package easily add sorting functionality to any of your models along with helpers to create the sorting links.

Table of Contents

Installation

Pull this package through Composer.

After the instalation add the ServiceProvider to the providers array in your config/app.php file

Finally to publish the table header view use:

This will create a table-sorter folder under your resources/views/vendor directory with the table header view.

Usage

To start using this package you only have to use the Sortable trait on the model you wish to allow sorting. This Trait allows you to use the sortable which will listen to the GET request parameters and execute the queries needed to sort the records.

On your controller scope your query to listen for the sorting using sortable method

This method will respond to urls following the convention below: your-site.dev/?sort={COLUMN-TO-SORT}&direction={asc/desc} To build the url you must specify the column name that has to be sorted and the direction, the direction parameter is optional, by default the direction will be ascending.

Sort Model Attributes

In order to sort by model attributes you have to specify the column name which should be sorted on the sort request variable.

Sort Model Relationships

In order to sort by model relationships the sort variable has to be set using this convention relation.column_name.

There is no limit on nested relationships levels, it will perform the necessary join queries to be able to sort by the attribute selected.

Sort Model Count Relationships

In order to sort by count relationships you must perform a withCount('relation') before calling sortable so Laravel can eager load the query the count relationship and attach it to the model. This way you will have avaiable the relation_count variable on the model and we can sort by it, specially useful in case that count has to be constrained.

Sort Links Helper

If you wish to generate the pagination and table header links, this package allows to define the table headers and their options on your model and render them.

By default all headers are sortable, so you don't need to specify that in the headers configuration, only specify the ones that should be disabled. The title can be ommited aswell, by default it will capitalize the column name. If you wish to add certain classes to the header selector, you can pass a string or an array of strings containing the classes that should be added as the example shows.

You'll need to call sortPaginate() or sortSimplePaginate() methods instead of laravel's paginate() and simplePaginate() in order to use the helper functions to render the paginator and the table header, to render those links you only need to call the sortLinks() method in your view.

In your controller:

Then in your view:

The method sortLinks() is a helper that will render the table headers that you specified with basic functionality, creating the links to sort ascending or descending aswell as inserting arrows to show the direction. The default view can be published to edit it, or you can specify your own by creating a sortLinksView property on your model. It accepts a path to a view as a parameter aswell.

The method pagination() delegates to links() method from laravel paginator appending the get request values needed to sort. You are free to use either, and append the values yourself, it is just a helper.

Contributing

You are more than welcome to contribute to the package by submitting a Pull Request.

License

The MIT License (MIT). Please see License File for more information.


All versions of table-sorter with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
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 rogercbe/table-sorter contains the following files

Loading the files please wait ....