Search by

shano / paginator

shano

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.0) of this package.

Pagination library for various list types in PHP.

Package info

github.com/shano/paginator

pkg:composer/shano/paginator

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0 2020-03-20 19:27 UTC

This package is auto-updated.

Last update: 2026-10-28 21:37:34 UTC


README

Pagination library for various list types in PHP.

Supported List Types

  • PHP Arrays
  • PHP ArrayObjects
  • Illuminate Collections (for Laravel)

Usage

<?php

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']));

?>

Installation

composer require shano/paginator

Running Unit Tests

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

TODOS

  • Better exception handling, right now it only exposes the underlying errors rather than errors that maintain the pagination level of abstraction.
  • Right now anything requested outside the allowable pagination just returns empty, should that also errors?
  • Better structure to unit tests
  • How collections are sliced needs improving