webanatorly / pagination
A library to split results into multiple pages
v1.0.1
2020-04-15 14:22 UTC
Requires
- php: >=7.0.0
This package is not auto-updated.
Last update: 2024-06-07 08:49:30 UTC
README
A library to split results into multiple pages
Install
Via Composer
$ composer require webanatoly/pagination
Usage
$obj = new Pagination\DirPager( new Pagination\PagesList(), 'photos', 3, 2); echo "<pre>"; print_r($obj->getItems()); echo "</pre>"; echo "<p>$obj</p>";
$obj = new Pagination\FilePager( new Pagination\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 Pagination\PdoPager( new Pagination\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). Please see License File for more information.