PHP code example of ecommit / paginator
1. Go to this page and download the library: Download ecommit/paginator 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/ */
ecommit / paginator example snippets
use Ecommit\Paginator\ArrayPaginator;
//Create a paginator
$paginator = new ArrayPaginator([
//Options
'page' => 1,
'max_per_page' => 100,
'data' => ['val1', 'val2', 'val3'],
//Or with an ArrayIterator
//'data' => new \ArrayIterator(['val1', 'val2', 'val3']),
]);
$totalPages = $paginator->getLastPage();
$countRows = \count($paginator);
foreach ($paginator as $result) {
//...
}