PHP code example of falgunphp / pagination
1. Go to this page and download the library: Download falgunphp/pagination library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
falgunphp / pagination example snippets
use Falgun\Pagination\Pagination;
$currentPage = 1;
$itemsPerPage = 10;
$maxLinkToShow = 5;
$pagination = new Pagination($currentPage, $itemsPerPage, $maxLinkToShow);
// set total item count we got from db/api
$pagination->setTotalItems(1000);
$paginationBag = $pagination->make();
// $paginationBag is a instance of Falgun\Pagination\PaginationBag
// It has four properties
// public Page $firstPage;
// public Page $lastPage;
// public Page $prePage;
// public Page $nextPage;
// public Iterator $links;
// You have to build your own html pagination from this $paginationBag