PHP code example of avn / paginator

1. Go to this page and download the library: Download avn/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/ */

    

avn / paginator example snippets


$idList = $someRepository->getIdList(); // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

$pagination = new Paginator(
    (new PaginatorRequest($idList))
        ->setCurrentPage(3)
        ->setLimit(2)
)

$totalPageCount = $pagination->getTotalPageCount(); // 5
$resultIdList = $pagination->getIdList(); // [5, 6]