- How do I install lampager/lampager-laravel in a Laravel app?
- Installation is Composer-only: run composer require lampager/lampager-laravel. There are no migrations, no publishable config file, and no queue workers to run, so nothing else is required beyond the package itself. Pin the constraint to ^0.6.1 and commit your lockfile so an unattended composer update cannot float the package onto an untested Laravel major.
- What is the difference between Lampager and Laravel's paginate() or simplePaginate()?
- Lampager adds keyset (seek) pagination, which builds WHERE conditions from the last row's sort values instead of using OFFSET/LIMIT. That keeps query cost flat as you page deeper, while offset pagination degrades on large, append-heavy tables. The trade-off is that you give up total counts and random page access in exchange for stable, reversible ordering.
- Which Laravel and PHP versions does lampager/lampager-laravel support?
- The package is aimed at Laravel 10 through 12 applications, and v0.6.1 proactively widens the illuminate/* constraints to permit Laravel 14 as well. A permitted constraint is not the same as tested support, so validate against your actual framework minor with a smoke test in staging. PHP 8.5 is also newly allowed, so confirm that runtime combination rather than assuming it.
- How do I use Lampager with an Eloquent model?
- Lampager wraps an existing Eloquent or query builder instance: you build the query as usual, specify a deterministic ORDER BY, and Lampager derives the seek conditions and cursor metadata for the next request. It does not own persistence, schema, or transport, so it simply shapes the read query in place. See the package README for the exact method names and response shape.
- Why does Lampager keyset pagination need a unique tiebreaker column?
- Keyset pagination compares each row against the last row's sort values, so a non-unique sort column can produce duplicate or skipped rows at page boundaries. Add a unique tiebreaker such as id alongside created_at to make the ordering deterministic. Without a stable, unique sort key the cursor cannot reliably identify where the previous page ended.
- What database index do I need for Lampager cursor pagination?
- Add a composite index that matches your ORDER BY exactly, for example (created_at, id). Keyset pagination is only fast when the database can satisfy the comparison and ordering from an index rather than sorting at query time. Before rolling out, run EXPLAIN on the new query and compare it against your current offset query.
- Can Lampager paginate backwards to a previous page?
- Yes. Lampager supports reversible ordering, so you can page backwards by reversing the sort direction and letting the adapter flip the seek conditions. This makes it usable for bidirectional infinite scroll and prev/next navigation. It still does not give you random access to an arbitrary page number.
- Does Lampager support total record counts or jump-to-page navigation?
- No. Keyset pagination returns a cursor for the next slice rather than an offset, so there is no total count and no way to jump to page 7. That makes Lampager a poor fit for admin tables that need record counts and page links. It fits list endpoints behind infinite scroll, activity feeds, exports, and delta-sync APIs.
- Is lampager/lampager-laravel safe for production given it is 0.x?
- The package is 0.x semver with a single maintainer and community support, so there is no vendor SLA and minor releases may carry breaking changes. v0.6.1 is a patch and is itself low risk, but there is no explicit stability guarantee yet. Pin the constraint, commit the lockfile, and treat composer update as a reviewed change rather than routine maintenance.
- How should I test and roll out Lampager pagination safely?
- Spike on one non-critical list endpoint behind a feature flag, add and verify the composite index, and compare EXPLAIN against the existing offset query. Dual-run the offset and keyset paths and diff the result sets over a defined soak period to catch boundary duplicates or skips. Write feature tests that walk across page boundaries asserting no missing or repeated rows, and confirm the package's own CI actually exercises your PHP and Laravel combination before trusting green builds.