PHPackages                             lampager/lampager-idiorm - 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. lampager/lampager-idiorm

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

lampager/lampager-idiorm
========================

Rapid pagination for Idiorm and Paris

v0.2.3(4y ago)451MITPHPPHP &gt;=5.6

Since Nov 19Pushed 3y ago6 watchersCompare

[ Source](https://github.com/lampager/lampager-idiorm)[ Packagist](https://packagist.org/packages/lampager/lampager-idiorm)[ RSS](/packages/lampager-lampager-idiorm/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (8)Used By (0)

[![lampager-idiorm](https://user-images.githubusercontent.com/1351893/32459320-948766b8-c372-11e7-84b9-061ffa6233ba.png)](https://user-images.githubusercontent.com/1351893/32459320-948766b8-c372-11e7-84b9-061ffa6233ba.png)

[![Build Status](https://github.com/lampager/lampager-idiorm/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/lampager/lampager-idiorm/actions)[![Coverage Status](https://camo.githubusercontent.com/b0f451ac8600c02ef8a2727ab0c0e9ac76ff7669ac876b95af16796ef57bae68/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c616d70616765722f6c616d70616765722d6964696f726d2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/lampager/lampager-idiorm?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5567067815fbf44b21e9b48f748a56ff051c6c727a8873f09445828eee6be4d1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c616d70616765722f6c616d70616765722d6964696f726d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lampager/lampager-idiorm/?branch=master)

Lampager for Idiorm and Paris
=============================

[](#lampager-for-idiorm-and-paris)

Rapid pagination without using OFFSET

Requirements
------------

[](#requirements)

- PHP: `>=5.6`
- [j4mie/idiorm](https://github.com/j4mie/idiorm): `^5.4`, [j4mie/paris](https://github.com/j4mie/paris): `^1.5`
- [lampager/lampager](https://github.com/lampager/lampager): `^0.4`

Installing
----------

[](#installing)

```
composer require lampager/lampager-idiorm
```

Basic Usage
-----------

[](#basic-usage)

You can wrap `ORM` instance with global function `lampager()` to make it chainable.

```
$cursor = [
    'id' => 3,
    'created_at' => '2017-01-10 00:00:00',
    'updated_at' => '2017-01-20 00:00:00',
];

$result = lampager(ORM::for_table('posts')->where_equal('user_id', 1))
    ->forward()
    ->limit(5)
    ->order_by_desc('updated_at') // ORDER BY `updated_at` DESC, `created_at` DESC, `id` DESC
    ->order_by_desc('created_at')
    ->order_by_desc('id')
    ->seekable()
    ->paginate($cursor)
    ->to_json(JSON_PRETTY_PRINT);
```

It will run the optimized query.

```
SELECT * FROM (

    SELECT * FROM `posts`
    WHERE `user_id` = 1
    AND (
        `updated_at` = '2017-01-20 00:00:00' AND `created_at` = '2017-01-10 00:00:00' AND `id` > 3
        OR
        `updated_at` = '2017-01-20 00:00:00' AND `created_at` > '2017-01-10 00:00:00'
        OR
        `updated_at` > '2017-01-20 00:00:00'
    )
    ORDER BY `updated_at` ASC, `created_at` ASC, `id` ASC
    LIMIT 1

) `temporary_table`

UNION ALL

SELECT * FROM (

    SELECT * FROM `posts`
    WHERE `user_id` = 1
    AND (
        `updated_at` = '2017-01-20 00:00:00' AND `created_at` = '2017-01-10 00:00:00' AND `id`  $value` or an object that implements `\Lampager\Contracts\Cursor`. It must be **all-or-nothing**.
    - For initial page, omit this parameter or pass empty array.
    - For subsequent pages, pass all parameters. Partial parameters are not allowd.

#### Return Value

[](#return-value)

e.g.

```
object(Lampager\Idiorm\PaginationResult)#1 (5) {
  ["records"]=>
  array(5) {
    [0]=>
    object(ORM)#2 (22) { ... }
    [1]=>
    object(ORM)#3 (22) { ... }
    [2]=>
    object(ORM)#4 (22) { ... }
    [3]=>
    object(ORM)#5 (22) { ... }
    [4]=>
    object(ORM)#6 (22) { ... }
  }
  ["hasPrevious"]=>
  bool(false)
  ["previousCursor"]=>
  NULL
  ["hasNext"]=>
  bool(true)
  ["nextCursor"]=>
  array(2) {
    ["updated_at"]=>
    string(19) "2017-01-18 00:00:00"
    ["created_at"]=>
    string(19) "2017-01-14 00:00:00"
    ["id"]=>
    int(6)
  }
}
```

### Paginator::useFormatter()
Paginator::restoreFormatter()
Paginator::process()

[](#paginatoruseformatterpaginatorrestoreformatterpaginatorprocess)

Invoke Processor methods.

```
Paginator::useFormatter(\Lampager\Formatter|callable $formatter): $this
Paginator::restoreFormatter(): $this
Paginator::process(\Lampager\Query $query, array|\IdiormResultSet $rows): \Lampager\idiorm\PaginationResult
```

### PaginationResult::toArray()
PaginationResult::jsonSerialize()

[](#paginationresulttoarraypaginationresultjsonserialize)

Convert the object into array.

**IMPORTANT: *camelCase* properties are converted into *snake\_case* form.**

```
PaginationResult::toArray(): array
PaginationResult::jsonSerialize(): array
```

### PaginationResult::\_\_call()

[](#paginationresult__call)

Call `IdiormResultSet` methods.

```
PaginationResult::__call(string $name, array $args): mixed
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~218 days

Recently: every ~306 days

Total

7

Last Release

1782d ago

PHP version history (2 changes)v0.1.0PHP ^5.6 || ^7.0

v0.2.2PHP &gt;=5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1351893?v=4)[mpyw](/maintainers/mpyw)[@mpyw](https://github.com/mpyw)

---

Top Contributors

[![mpyw](https://avatars.githubusercontent.com/u/1351893?v=4)](https://github.com/mpyw "mpyw (21 commits)")

---

Tags

fastidiormpaginationpaginatorphplaravelpaginatorpaginationilluminatelimitoffset

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lampager-lampager-idiorm/health.svg)

```
[![Health](https://phpackages.com/badges/lampager-lampager-idiorm/health.svg)](https://phpackages.com/packages/lampager-lampager-idiorm)
```

###  Alternatives

[lampager/lampager-laravel

Rapid pagination for Laravel

7641.4k](/packages/lampager-lampager-laravel)[lampager/lampager

Rapid pagination without using OFFSET

3778.3k5](/packages/lampager-lampager)[paysera/lib-pagination

Paginates Doctrine QueryBuilder using cursor based or offset based pagination

13191.8k1](/packages/paysera-lib-pagination)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
