tuupola / beeper
Generic paginator for PHP 7.1+
Installs: 10 815
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 2
Open Issues: 2
Requires
- php: ^7.1|^8.0
Requires (Dev)
- league/fractal: ^0.15.0
- overtrue/phplint: ^1.0|^2.0
- phpstan/phpstan: ^0.12.98
- phpunit/phpunit: ^7.0|^8.0|^9.0
- squizlabs/php_codesniffer: ^3.4
Suggests
- vlucas/spot2: Allows running Spot tests
This package is auto-updated.
Last update: 2024-12-20 18:31:25 UTC
README
Generic pager for PHP 7.1+
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(); $beeper->next(); $beeper->next(); print_r($beeper->get());
Array
(
[0] => 11
[1] => 12
)