PHP code example of ardiakov / simple-pagination
1. Go to this page and download the library: Download ardiakov/simple-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/ */
ardiakov / simple-pagination example snippets
$perPage = 20;
$currentPage = (int) $request->query->get('page', 1);
$qb = $this->repository->paginationQuery();
$pagination = new Paginator($perPage, $currentPage, new DoctrineOrmDataProvider($qb));
return [
'list' => $pagination->result(),
'currentPage' => $currentPage,
'pages' => $pagination->pages(),
'totalResult' => $pagination->countResult(),
];