1. Go to this page and download the library: Download shorif2000/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/ */
shorif2000 / pagination example snippets
use Pagination\PaginatorFactory;
use Pagination\Lib\ArrayPageProvider;
...
$pageNumber = 1;
$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$pagination = (new PaginatorFactory(new ArrayPageProvider($input)))->createPaginator($pageNumber, $itemsPerPage);
use Pagination\PaginatorFactory;
use Pagination\Lib\ArrayObjectPageProvider;
...
$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$input = new \ArrayObject($input);
$pageNumber = 1;
$pagination = (new PaginatorFactory(new ArrayObjectPageProvider($input)))->createPaginator($pageNumber, $itemsPerPage);
public function getItems();
public function getCurrentPageNumber(): int;
public function getNumberOfPages(): int;
public function getTotal(): int;
public function getTotalOnCurrentPage(): int;
public function getTotalPerPage(): int;
use Pagination\PaginatorFactory;
use Pagination\Lib\DbPagintaor;
...
$pageNumber = 1;
$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$pdo = ''; // mysql resource
$table = 'country';
$pagination = (new PaginatorFactory(new DbPagintaor($pdo, $table)))->createPaginator($pageNumber, $itemsPerPage);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.