anstag / pager
Pager library
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/anstag/pager
This package is auto-updated.
Last update: 2025-11-29 02:50:32 UTC
README
Pager library to split results into multiple pages
Install
Via Composer
$ composer require anstag/pager
Usage
$obj = new Anstag\Pager\DirPager( new Anstag\Pager\PagesList(), 'photos', 3, 2 ); echo "<pre>"; print_r($obj->getItems()); echo "</pre>"; echo "<p>$obj</p>";
$obj = new Anstag\Pager\FilePager( new Anstag\Pager\ItemsRange(), 'largetextfile.txt' ); echo "<pre>"; print_r($obj->getItems()); echo "</pre>"; echo "<p>$obj</p>";
try { $pdo = new PDO( 'mysql:host=localhost;dbname=test', 'root', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION] ); $obj = new Anstag\Pager\PdoPager( new Anstag\Pager\ItemsRange(), $pdo, 'table_name' ); echo "<pre>"; print_r($obj->getItems()); echo "</pre>"; echo "<p>$obj</p>"; } catch (PDOException $e) { echo "Can't connect to database"; }
License
The MIT License (MIT).