Enumerator in php
You can install the package via composer:
composer require tleckie/paginator
<?php
require_once "vendor/autoload.php";
use Tleckie\Paginator\Paginator;
$paginator = new Paginator(100,10, 2);
$paginator->getTotalPages();// 10
$paginator->getLastPage(); // 10
$paginator->getOffset(); // 10
$paginator->getPrevPage(); // 1
$paginator->getNextPage(); // 3
$paginator->hasNext(); // true
$paginator->hasPrev(); // true
PaginatorInterface
public function getTotalRecords(): int;
public function getItemsPerPage(): int;
public function getCurrentPage(): int;
public function setCurrentPage(int $currentPage): PaginatorInterface;
public function setTotalRecords(int $totalRecords): PaginatorInterface;
public function setItemsPerPage(int $itemsPerPage): PaginatorInterface;
public function hasPrev(): bool;
public function hasNext(): bool;
public function getNextPage(): int;
public function getPrevPage(): int;
public function getLastPage(): int;
public function getFirstPage(): int;
public function getOffset(): int;
public function getTotalPages(): int;