Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Fast Paginate Laravel Package

spatie/laravel-fast-paginate

A fast limit/offset paginator for Laravel. The fastPaginate method selects only primary keys first so late pages stay fast, then fetches full rows for that page. Same signature and paginator as Laravel's paginate, so no other code changes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy on pagination performance. The decision is essentially "spend a sprint building a deferred-join helper" vs. "add a 1-line Spatie dependency." At 7 stars and 0 dependents this isn't a widely-vetted library, so the honest framing is buy-then-vendor: adopt it, validate it against your data, and be prepared to copy the ~1 method into your own codebase if maintenance stalls.
  • Pagination UX roadmap. It buys time for teams that need page-number navigation (jump-to-page, page counts, crawler-friendly URLs) but whose deep pages are timing out. It is a stopgap on the road to cursor pagination, not a substitute — a decision worth recording explicitly so it doesn't become permanent architecture by accident.
  • Where to spend performance budget. It scopes the perf work: only tables where users actually reach deep pages (admin panels, back-office reports, audit logs, exports) benefit. It does not help the common case of "page 1 is slow," which is usually an index or N+1 problem.
  • Feature scoping for list/reporting surfaces. Gives a concrete answer to "can we support page 500 on this 10M-row table?" without re-architecting the API contract — offset/page semantics stay intact, so no client changes.
  • Definition of done for perf tickets. Turns "make pagination faster" into a measurable acceptance criterion (p95 latency on page 100+ before/after), since the win is a constant-factor row-read reduction, not an asymptotic fix.

When to Consider This Package

Adopt when all of these hold:

  • You have offset pagination over a large table (roughly 1M+ rows, or wide rows with expensive column reads) and deep pages are measurably slow.
  • Page-number semantics are a hard requirement — jump-to-page UI, stable total counts, clients that can't switch to cursors.
  • Your WHERE and ORDER BY columns are indexed, ideally with the primary key appended, so the inner key-only query can be satisfied from the index.
  • Queries are plain Eloquent/query-builder selects — no groupBy, having, union, distinct, or exotic select aliases that break the two-step fetch.
  • You're on a supported Laravel version and can benchmark against production-shaped data before rollout.

Look elsewhere when:

  • You can move to keyset pagination. Laravel's built-in cursorPaginate() is O(1) on deep pages and already in the framework. If the UI tolerates "next/previous" instead of "page N," this package is the wrong answer.
  • The dataset is small. Below ~100k rows the extra round trip adds latency for no gain.
  • Queries are complex. Reporting SQL, unions, aggregates, and heavy withCount usage are outside its sweet spot and will silently degrade.
  • Dependency hygiene matters. 7 stars, 0 dependents, README-and-releases-only maturity means you are an early adopter. Fine for an internal admin tool behind a feature flag; a harder sell for a revenue-critical API.

How to Pitch It (Stakeholders)

To executives: This is a low-cost, MIT-licensed fix for slow back-office list pages — deep pages currently force the database to read every preceding row, and this package cuts that per-page cost substantially. It's a one-line change on affected screens, requires no API or client changes, and needs no vendor contract. Treat it as a tactical optimization with a defined exit path, not a platform bet.

To engineering: It implements a deferred join — a key-only indexed query for the page's IDs, then a primary-key lookup for full rows. We should (1) benchmark p95 on deep pages against production-shaped data, (2) confirm the inner query is index-covered, (3) check for groupBy/union/distinct in affected queries, and (4) keep the change isolated per-endpoint so reverting is a one-line diff. The real long-term answer for high-traffic endpoints remains cursor pagination; this unblocks the page-number UX in the meantime. Given the package's adoption profile, assume we may need to vendor the implementation — the method is small enough that this is a contained risk.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style