Keyset pagination
Each page is fetched with a WHERE clause built from the last row of the previous page, never an OFFSET.
composer require silarhi/cursor-paginationKeyset pagination
Each page is fetched with a WHERE clause built from the last row of the previous page, never an OFFSET.
Multi-field ordering
Combine several fields, each ascending or descending, ending with a unique one.
Item or chunk iteration
Iterate entity by entity, or by arrays of maxPerPages items for flush and clear batches.
Restartable iterations
Every iteration starts from the beginning with its own cursor, even if a previous one was stopped early.
Fetch joins handled
One query per page, or two when the query joins a collection or another entity (JOIN … WITH): the page’s ids,
then their rows.
Query analysis
Collection joins and scalar rows are detected; misconfigured orders throw instead of skipping rows.
Counting
count() and getNbPages(), with a plain COUNT when no join can duplicate rows.