PHPackages                             todstoychev/table-sorter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. todstoychev/table-sorter

ActiveLibrary

todstoychev/table-sorter
========================

Table sorter module for Laravel 5

v0.1.0(10y ago)1959MITPHPPHP &gt;=5.4

Since Nov 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/todstoychev/table-sorter)[ Packagist](https://packagist.org/packages/todstoychev/table-sorter)[ Docs](https://github.com/todstoychev/table-sorter)[ RSS](/packages/todstoychev-table-sorter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Table sorter is simple Laravel 5 module. It can be used to sort table columns.

Instalation
===========

[](#instalation)

Use the standart composer way to install the module:

```
composer require todstoychev/table-sorter

```

or add to the require clause of your composer.json:

```
"todstoychev/table-sorter": "dev-master"
```

Configuration
=============

[](#configuration)

Open `config/app.php` and add to `'providers'` the module service provider:

```
'providers' => [
    // ...
    Todstoychev\TableSorter\ServiceProvider::class,
    // ...
],
```

Then create an alias for the package main class:

```
'aliases' => [
    // ...
    'TableSorter' => Todstoychev\TableSorter\TableSorter::class,
    // ...
],
```

Run `php artisan vendor/publish` command to publish the views contained in the package.

Usage
=====

[](#usage)

The class contains 2 methods - sort() and sortSearch(). Both take different params. The methods return simple templates used to form the column name link with the necessary parameters. Since those parameters are presented in the Laravel request object, you can use them to construct you database query. For example you can use in your template

```

    {!! TableSorter::sort('Namespace\MyController@getMyAction', 'text.to.use.for.columnName', 'database.table.columnName', 'asc', 10) !!}

```

First argument is your get page controller method. Second argument is the text that should be shown as column name in the table. Third argument is the database table column name or alias from which the data is coming. Fourth one is the sorting direction. This can be provided as variable since it is determined by the module itself. Last argument is used to represent items per page number, in case you are using pagination.

The other method provided by the module can be used to sort search results.

```

    {!! TableSorter::sortSearch('Namespace\MyController@getMyAction', 'text.to.use.for.columnName', 'search.string', 'database.table.columnName', 'asc') !!}

```

This one works almost in the same way. The difference is that it not provides value for items per page and has search string parameter.

To make this will work you will need to create something similar in your controller:

```
class MyController
{
    public function getMyAction(Request $request)
    {
        // Get parameters
        $limit = $request->input('limit') ? $request->input('limit') : null;
        $order = $request->input('order') ? $request->input('order') : null;
        // Database column name or alias
        $param = $request->input('param') ? $request->input('param') : null;

        $query = MyModel::orderBy($param, $order);
        $results = $query->paginate($limit);

        return view('my.view', [
            'limit' => $limit,
            'order' => $order,
            'param' => $parm,
            'results' => $results
        ]);
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3831d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4d5af278828b70e08928a5c1a6b33975cb9709ef0829d4822b5b083887a410f?d=identicon)[todstoychev](/maintainers/todstoychev)

---

Top Contributors

[![todstoychev](https://avatars.githubusercontent.com/u/4498971?v=4)](https://github.com/todstoychev "todstoychev (13 commits)")

---

Tags

sorttablecolumn

### Embed Badge

![Health badge](/badges/todstoychev-table-sorter/health.svg)

```
[![Health](https://phpackages.com/badges/todstoychev-table-sorter/health.svg)](https://phpackages.com/packages/todstoychev-table-sorter)
```

###  Alternatives

[kyslik/column-sortable

Package for handling column sorting in Laravel 6.x

6485.6M21](/packages/kyslik-column-sortable)[mottie/tablesorter

tablesorter (FORK) is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.

2.6k223.5k](/packages/mottie-tablesorter)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[indexzer0/eloquent-filtering

Powerful eloquent filtering

22425.9k3](/packages/indexzer0-eloquent-filtering)[akaunting/laravel-sortable

Sortable behavior package for Laravel

27175.6k](/packages/akaunting-laravel-sortable)[liqueurdetoile/cakephp-orm-json

Cakephp plugin to provide easy control over JSON type fields in database

1461.1k](/packages/liqueurdetoile-cakephp-orm-json)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
