What is the Pagination library in CodeIgniter 4?
Answer
CodeIgniter 4 includes a built-in Pager class for pagination. In a model, use paginate() directly: $users = $this->userModel->paginate(15) — this returns the current page's data. Get the pager: $pager = $this->userModel->pager. In the view: <?= $pager->links() ?> renders navigation links. The current page is automatically read from the page query parameter in the URL. Customize templates in app/Views/Pager/. For non-model pagination (manual queries): $pager = service("pager"); $pager->makeLinks($currentPage, $perPage, $total). CI4's Pager generates clean Bootstrap-compatible pagination HTML and supports multiple pager groups per page for paginating multiple datasets simultaneously.
Previous
What is the Database class in CodeIgniter 4?
Next
What is the Email library in CodeIgniter 4?