medisolbv / pagination
A simple package to allow easy generation of pagination links
1.0.0
2024-09-06 08:15 UTC
Requires
- php: ^8.2
Requires (Dev)
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^11.3
- squizlabs/php_codesniffer: *
This package is not auto-updated.
Last update: 2025-07-12 10:27:41 UTC
README
This is a simple package to generate the correct pagination links.
Usage
A new Paginator
object can be instantiated with the Paginator::create
method. This method takes two parameters;
int $currentPage
int $totalPages
.
Generating links
After instantiating a new Paginator
object, the generate
method can be used to generate the required links.
Getting the links
After generating links, you can use these links by calling the Paginator::getLinks
method. When returning the result
in JSON format, the links will be serialized to JSON.
Available link methods
PaginationLink::getPage
: returns the link's page numberPaginationLink::isActive
: returns whether the current page is this pagePaginationLink::isDisabled
: returns whether this page is disabled (for example, the ellipsis between different link ranges).