Generates pagination HTML.
Add the package as a requirement to your composer.json
:
$ composer require starlit/paginator
<?php
use Starlit\Paginator;
$currentPageNo = 1;
$rowsPerPage = 10;
$totalRowCount = 20;
$paginator = new Paginator(
$currentPageNo,
$rowsPerPage,
$totalRowCount,
function ($page) {
return 'index.php?page=' . $page;
}
);
echo $paginator->getHtml();
Produces:
<div class="pagination multiple-pages">
<ul>
<li class="previous disabled"><span>«</span></li>
<li class="active"><a href="index.php?page=1">1</a></li>
<li><a href="index.php?page=2">2</a></li>
<li class="next"><a href="index.php?page=2">»</a></li>
</ul>
</div>
- Requires PHP 7.1 or above.
This software is licensed under the BSD 3-Clause License - see the LICENSE
file for details.