PHP code example of pioniro / pagination
1. Go to this page and download the library: Download pioniro/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/ */
pioniro / pagination example snippets
use Pioniro\Pagination\Pagination\QueryBuilderPagination;
use Pioniro\Pagination\Pager\CursorPager;
// give me 10 items after item(id=15)
$pager = new CursorPager(10, null, 15);
$qb = $entityManager
->createQueryBuilder('App:Item', 'i')
->orderBy('i.id', 'ASC');
$pagination = new QueryBuilderPagination($qb, $pager);
// items can be obtained
foreach ($pagination as $item) {
// ...
}
// OR
foreach ($pagination->getItems() as $item) {
// ...
}
// new Pager same type as $pager
$pagination->getPager();