tsfcorp/lister

Listing library for Laravel
4,999 3
Install
composer require tsfcorp/lister
Latest Version:v2.0.3
PHP:>=7.1
License:MIT
Last Updated:May 20, 2026
Links: GitHub  ·  Packagist
Maintainer: tsfcorp

Listing library for Laravel

Makes it easy to list a resource

Upgrade from 1.x to 2.x

  • use TsfCorp\Lister\Facades\ListerFilter has been removed. use use TsfCorp\Lister\Filters\ListerFilter

Installation

Require this package in your composer.json and update composer. Run the following command:

composer require tsfcorp/lister

After updating composer, the service provider will automatically be registered and enabled, along with the facade, using Auto-Discovery

Next step is to run the artisan command to bring the config into your project

php artisan vendor:publish --provider="TsfCorp\Lister\ListerServiceProvider"

Update config/lister.php

Usage Instructions

Lister library can be added to your method signature, this way it will be resolved by DI container or it can be instatiated like this:

$lister = new Lister(request(), DB::connection());

Query settings must be specified in this format:

$query_settings = [
    'fields' => "users.*",

    'body' => "FROM users {filters}",

    'filters' => [
        "users.id IN (1,2,3)",
        "users.name LIKE '%{filter_name}%'",
    ],

    'sortables' => [
        'name' => 'asc',
    ],
    
    // optional, you can pass a model reference and the records returned 
    // will be of that type
    
    'model' => User:class,
];

$listing = $lister->make($query_settings)->get();
  • {filters} keyword must be specified in the body parameter, so it can be replaced with the conditions specified.
  • each item from filters param, will be added to WHERE clause. If the condition has a parameter specified in curly braces, we'll search for that parameter in the request and replace the parameter with value found.

If using remembered filters and also for query string cleanup, this is needed at the top of the method used:

if($redirect_url = $lister->getRedirectUrl()) return redirect($redirect_url);

Related Packages

oriceon/toastr-5-laravel

Easy toastr notifications for Laravel 5

503,999 79
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,315 160
oriceon/oauth-5-laravel

OAuth Service Provider for Laravel 5

1,671,889 174
artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

523,362 677
narutimateum/toastr-5.2-laravel

toastr.js for Laravel 5.2 easy notification like growl for example

37,567 13