PHPackages                             hadi/paginate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hadi/paginate

ActivePackage[Utility &amp; Helpers](/categories/utility)

hadi/paginate
=============

Simple pagination class

1.0.0(8y ago)155MITPHPPHP &gt;=5.3.0

Since Sep 10Pushed 8y ago2 watchersCompare

[ Source](https://github.com/im4aLL/paginate)[ Packagist](https://packagist.org/packages/hadi/paginate)[ RSS](/packages/hadi-paginate/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Installation
------------

[](#installation)

```
composer require hadi/paginate

```

### Usage

[](#usage)

```
require_once __DIR__ . '/../vendor/autoload.php';

$config = [
    'host' => 'localhost',
    'name' => 'abworkout',
    'username' => 'root',
    'password' => '',
];

$db = new \Hadi\Database(); 											// https://github.com/im4aLL/pdo-mysql-driver
$db->connect($config);

$total = $db->query("SELECT id FROM orders")->get();

$paginate = new \Hadi\Paginate([
    'per_page' => 1,
    'page_param' => 'page',
    'page_url' => 'http://localhost/paginate/test/',
    'total_record' => count($total),
]);

$orders = $db->query("SELECT * FROM orders ".$paginate->limit())->get();

echo $paginate->limit().' ';

foreach($orders as $order) {
    echo $order->id.' - ';
    echo $order->order_number;
    echo '';
}

$db->disconnect();
```

### More usage

[](#more-usage)

```

Total records:

Page  of
