1. Go to this page and download the library: Download ucscode/easy-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/ */
ucscode / easy-paginator example snippets
use Ucscode\Paginator\Paginator;
$paginator = new Paginator(
totalItems: 100, // Total number of items
itemsPerPage: 10, // Items per page
currentPage: 3, // Current page
urlPattern: '?page=(:num)' // URL pattern with placeholder
);
$paginator->getTotalPages(); // Total number of pages
$paginator->getCurrentPage(); // Current page number
$paginator->getNextPage(); // Next page number or null if last page
$paginator->getPrevPage(); // Previous page number or null if first page
$paginator->getPageUrl(5); // Returns '?page=5'
$paginator->getNextUrl(); // URL for the next page
$paginator->getPrevUrl(); // URL for the previous page