Download the PHP package ismailnakkar/laravel-listing without Composer

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

laravel-listing

Easy querying and filtering for Blade list pages. Declare, once, in the controller, the filters and sorts a page's query string may set. The package reads them leniently, so a mistyped id, a stale bookmark or a hostile URL shows the default list, never a 4xx or 5xx.

Requires PHP 8.4 and Laravel 13.

Install

That is the whole install: no service provider, no config, no views.

A listing

?status=shipped&paid=0&q=lamp&from=2026-10-01&sort=-total&page=2 is the second page of unpaid, shipped orders matching "lamp" since October 1st, largest first. paginate() takes a page size, else the model's $perPage. Its links keep the query string. A ?page that is not a positive whole number, or so large that its offset would overflow, shows the first page; a page past the last one is empty, as in Laravel. For large tables, simplePaginate() and cursorPaginate() skip the COUNT; see Paging.

Filters

Method Reads ?key= as Keeps the rows where
int($key, $column = null, $max = PHP_INT_MAX) a positive int up to $max the column is it
text($key, $column = null, $max = 255) the trimmed string; empty is null the column is it
flag($key, $column = null) '1' as true, '0' as false the column is it
enum($key, Enum::class, $column = null) the backed case; an int-backed enum reads digits only the column is it
enums($key, Enum::class, $column = null) a list of backed cases: ?key[]=a&key[]=b, or one ?key=a the column is any of them
ints($key, $column = null, $max = PHP_INT_MAX) a list of positive ints up to $max the column is any of them
search($key, $columns = null, $max = 255) the trimmed string; empty is null any of the columns contains it, as typed
date($key, $column = null, $operator = '=') a real day, 2026-10-01 the column falls on it (=), on or after it (>=), or on or before it (<=)

Search

search() keeps the rows where any of the columns contains the term as typed: %, _, ! and [ match themselves.

Date ranges

Both days count, whole. ?from=2026-10-01&to=2026-10-31 keeps created_at >= '2026-10-01' and < '2026-11-01', so all of the 31st is in, and an index on the column serves the range. A day before 1753-01-01, where SQL Server's datetime starts, reads as null.

From and to are days on the column's own clock:

Sorts

sorts() names what ?sort= may use: ?sort=total is ascending, ?sort=-total descending.

How the order is chosen:

Keep the list narrow: each column needs an index, or the page scans on every click. On PostgreSQL the index has to cover the column and the key.

The current request

Pass Listing::for() the current request: paginator links are built from the container's request.

A relation

Listing::for() takes a relation as well as a query, and pages it as itself, so each row keeps its pivot:

A filter the package does not cover

Pass a closure in place of the column. It runs only when there is a value, and gets the query and the typed value:

Filter Value the closure gets
int() an int
flag() a bool
enum() the case
enums() a non-empty list of cases
ints() a non-empty list of ints
text() and date() a string

On a relation, the closure's query is the relation's own, so name a pivot column in full there too. A closure that parses its value further must not hand the database an impossible value.

The view

Refill the form from $listing->values, never from request(): {{ request('q') }} fails the page on ?q[]=x. Every declared key is there, holding its typed value or null, so compare with ===: an enum() holds the case, a flag() a bool. The hidden sort keeps the order when the form is sent.

For enums() or ints(), the field sends a list, from a multiple select or checkboxes named status[], and the value is a list, so the refill tests membership:

A sortable header:

To make each header one line, save this as resources/views/components/sort-header.blade.php:

Paging

Method Gives Use it for
paginate($perPage = null) a page with a total and page links most screens
simplePaginate($perPage = null) previous and next only, with no COUNT query a table too large to count
cursorPaginate($perPage = null) previous and next by cursor, with no COUNT and no OFFSET a very large table

Each takes a page size, else the model's $perPage, and its links keep the query string.

Without paging

apply() is the filtered, sorted query without paging:

A relation stays a relation. Page through the three methods above rather than apply(): they carry the page cap and the cursor guard.

Reusing a listing

Authorization

The listing only reads the query string. Who may see the page is the route's business: put Laravel 13's #[Authorize('viewAny', Order::class)] on the controller or action, or ->can('viewAny', Order::class) on the route.

Traps

Engine notes

Testing

The same suite runs on another engine through Laravel's own variables, for example PostgreSQL:

CI runs SQLite on PHP 8.4 and 8.5, and PostgreSQL 18, MariaDB 11.8 and MySQL 8.4. Before a release, also run the suite against:

Then do a mutation pass on SQLite and PostgreSQL: revert each guard, and some test must fail.

Upgrading

From 0.4

From 0.3

Deliberately not here

Query DSLs, multi-column sort and JSON APIs. For an API, use spatie/laravel-query-builder. A list page that needs more reads $listing->values and writes it.

Licence

MIT.


All versions of laravel-listing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/framework Version ^13.0
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 ismailnakkar/laravel-listing contains the following files

Loading the files please wait ...