PHPackages                             younes\_mlik/hybrid-pagination - 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. [Database &amp; ORM](/categories/database)
4. /
5. younes\_mlik/hybrid-pagination

ActiveLibrary[Database &amp; ORM](/categories/database)

younes\_mlik/hybrid-pagination
==============================

Hybrid pagination for Laravel.

v0.0.1(1y ago)01[3 issues](https://github.com/YounesMlik/hybrid-pagination/issues)MITPHPPHP ^8.2

Since Apr 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/YounesMlik/hybrid-pagination)[ Packagist](https://packagist.org/packages/younes_mlik/hybrid-pagination)[ Docs](https://github.com/YounesMlik/hybrid-pagination)[ RSS](/packages/younes-mlik-hybrid-pagination/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Hybrid Pagination for Laravel Eloquent
======================================

[](#hybrid-pagination-for-laravel-eloquent)

[![Laravel](https://camo.githubusercontent.com/52203ec26bee6217988c56cb03ec5b9f3e02add27ae246e5e729cc15c953742e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531312e302d7265642e737667)](https://laravel.com)
[![PHP](https://camo.githubusercontent.com/aff0b1ebd8bae48ba12ef0b1128d6460084232cd88d6e102969df5f5eea3b35a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e302d626c75652e737667)](https://www.php.net)
[![License](https://camo.githubusercontent.com/bbfeb67cff110b7c14cc3d0a78143446e315325a5de4b3ce7558f30d54254f87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f596f756e65734d6c696b2f6879627269642d706167696e6174696f6e)](LICENSE)

Hybrid Pagination is a scalable pagination solution that enhances Laravel’s Eloquent ORM by combining the convenience of offset-based with the performance of cursor-based pagination. This allows:

- **Direct page jumps (offset-style navigation)**
- **Efficient handling of large datasets (cursor-based optimization)**
- **Significantly lower database expense**

Unlike traditional pagination methods, Hybrid Pagination provides random page access without sacrificing performance.

Features
--------

[](#features)

✅ Fluent API similar to Laravel’s built-in pagination.
✅ Works with Eloquent – Supports complex queries and relationships.
✅ Optimized for Large Datasets – Avoids deep offset performance issues.
✅ Customizable Navigation – Configure cursor fields, page names, and total count behavior.

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

[](#installation)

```
composer require younes_mlik/hybrid-pagination
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
namespace App\Models;

use App\Traits\CanHybridPaginate;

class User extends Model
{
    use CanHybridPaginate;

    ...
```

```
$users = User::
    orderBy("first_name")->
    orderBy("id")->
    hybridPaginate(4, "*");
```

Configuration
-------------

[](#configuration)

You can publish the configuration file:

```
php artisan vendor:publish --tag=hybrid-pagination-config
```

Config file (`config/hybrid_pagination.php`):

```
return [
    'default_cursor_field' => 'id',
    'threshold' => 1000, // Switch to cursor pagination when offset exceeds this value
];
```

Why Use Hybrid Pagination?
--------------------------

[](#why-use-hybrid-pagination)

FeatureOffset PaginationCursor PaginationHybrid PaginationRandom page access✅❌✅Performance on large datasets❌✅✅License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/license/mit).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance48

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

384d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/795e80b19141ff08eef94cc0472c09fc1ddd9d08ebdff0133abd4b3367d13923?d=identicon)[YounesMlik](/maintainers/YounesMlik)

---

Top Contributors

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

---

Tags

laraveldatabasepaginationeloquentilluminate

### Embed Badge

![Health badge](/badges/younes-mlik-hybrid-pagination/health.svg)

```
[![Health](https://phpackages.com/badges/younes-mlik-hybrid-pagination/health.svg)](https://phpackages.com/packages/younes-mlik-hybrid-pagination)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)

PHPackages © 2026

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