Generic paginator for PHP 5.4+
PHP JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.jshintrc
.travis.yml
Gruntfile.js
LICENSE.txt
README.md
composer.json
package.json
phpunit.xml

README.md

Beeper

Generic pager for PHP 5.4+

Author Software License Build Status HHVM Status Coverage

Install

You can install latest version using composer.

$ composer require tuupola/beeper

Usage

use Beeper\Adapter\ArrayAdapter;
use Beeper\Beeper;

$array = range(1, 12, 1);
$adapter = new ArrayAdapter($array);

$beeper = new Beeper(["adapter" => $adapter, "size" => 5, "page" => 1]);

foreach ($beeper as $key => $page) {
    print_r($page);
}
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
)
Array
(
    [0] => 6
    [1] => 7
    [2] => 8
    [3] => 9
    [4] => 10
)
Array
(
    [0] => 11
    [1] => 12
)
$beeper
    ->rewind()
    ->next()
    ->next();

print_r($beeper->get());
Array
(
    [0] => 11
    [1] => 12
)