See More

> For the complete documentation index, see [llms.txt](https://docs.sonsofphp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonsofphp.com/components/pager.md). # Pager Simple yet powerful pagination ## Installation ```shell composer require sonsofphp/pager ``` ## Usage Basic Usage ```php 1, 'max_per_page' => 10, ]); // You can also set current page and max per page $pager->setCurrentPage(1); $pager->setMaxPerPage(10); $totalPages = $pager->getTotalPages(); $totalResults = $pager->getTotalResults(); $currentPage = $pager->getCurrentPage(); if ($pager->haveToPaginate()) { // ... } if ($pager->hasPreviousPage()) { $prevPage = $pager->getPreviousPage(); // ... } if ($pager->hasNextPage()) { $nextPage = $pager->getNextPage(); // ... } ```