lehatyapachkin / pager
A library to split results into multiple pages
dev-master
2017-11-09 21:27 UTC
Requires
- php: >=7.0.0
- curl/curl: *
- monolog/monolog: *
- phpdocumentor/phpdocumentor: 2.*
- psy/psysh: *
- robmorgan/phinx: *
- squizlabs/php_codesniffer: *
Requires (Dev)
This package is not auto-updated.
Last update: 2020-01-10 16:47:48 UTC
README
A library to split results into multiple pages
Install
Via Composer
$ composer require lehatyapachkin/pager
Usage
$obj = new LTPager\DirPager( new LTPager\PagesList(), 'photos', 3, 2); echo "<pre>"; print_r($obj->getItems()); echo "</pre>"; echo "<p>$obj</p>";
$obj = new LTPager\FilePager( new LTPager\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 LTPager\PdoPager( new LTPager\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.