yalayolooo/pagerpro

A library to split results into multiple pages

dev-main 2022-08-30 10:29 UTC

This package is not auto-updated.

Last update: 2025-06-18 22:03:50 UTC


README

Software License

A library to split results into miltiple pages

Install

Via Composer

$ composer require yalayolooo/pagerpro

Usage

$obj = new ISPagerPro\DirPage(
    new ISPagerPro\PagesList(),
    'photos',
    3,
    2
);
echo "<pre>";
print_r($obj->getItems());
echo "</pre>";
echo "<p>$obj</p>";
$obj = new ISPagerPro\FilePager(
    new ISPagerPro\ItemsRange(),
    'largertextfile.txt'
);
echo "<pre>";
echo "<p>$obj</p>";
try {
    $pdo = new PDO(
        'mysql:host=localhost;dbname=test',
        'root',
        '',
        [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
    );
    $obj = new ISPagerPro\PdoPage(
        new ISPagerPro\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] (https://github.com/dnoegel/php-xdg-base-dir/blob/master/LICENSE) for more information.