1. Go to this page and download the library: Download xandros15/slim-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/ */
xandros15 / slim-pagination example snippets
use Xandros15\SlimPagination\Pagination;
$app->get('/users', function (Request $request, Response $response) {
$users = User::search($request);
$pagination = new Pagination($request, $this->get('router'),[
Pagination::OPT_TOTAL => count($users), //number of items
]);
$paginationString = $this-view->fetch('pagination', ['pagination' => $pagination]);
return $this->view->render('user.index', ['pagination' => $paginationString]);
})->name('user.index');