starlit / paginator
Generates pagination HTML.
Installs: 42 332
Dependents: 1
Suggesters: 1
Security: 0
Stars: 2
Watchers: 6
Forks: 1
Open Issues: 0
Requires
- php: >=8.0
- symfony/http-foundation: ~4.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-19 16:46:30 UTC
README
Generates pagination HTML.
Installation
Add the package as a requirement to your composer.json
:
$ composer require starlit/paginator
Usage
<?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>
Requirements
- Requires PHP 7.1 or above.
License
This software is licensed under the BSD 3-Clause License - see the LICENSE
file for details.