New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

tsfcorp/lister

Listing library for Laravel
5,132 3
Install
composer require tsfcorp/lister
Latest Version:v2.0.3
PHP:>=7.1
Laravel:9 – 13
Older releases:5 – 8
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

valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

413,065 233
php
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

22,912 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

17,788 0
php
cline/toggl

Advanced feature flag management with strategies, time bombs, and groups

12,171 0
php
cline/sequencer

Sequential migration and operation orchestration for Laravel

11,736 0
php

Version History

Version Released PHP Laravel License
v2.0.3 >=7.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v2.0.2 >=7.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v2.0.1 >=7.1 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v2.0.0 >=7.1 ^9.0|^10.0|^11.0|^12.0 MIT
v1.0.5 >=7.1 ^5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT