PHP code example of shano / paginator

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

    

shano / paginator example snippets




use Paginator\Adapters\InputAdapterCollection;
use Paginator\Paginator;

$list = new InputAdapterCollection(
    new \ArrayObject(['alpha', 'beta', 'gamma', 'delta'])
);

$elementsPerPage = 2;
$page = 1;

$pagination = (new Paginator($list, $elementsPerPage))->paginate($page)->elements();
// Returns \ArrayObject(['gamma', 'delta']));

bash
git clone https://github.com/shano/paginator
cd paginator
composer install --dev
php vendor/bin/phpunit
php vendor/bin/phpunit  --coverage-text