承接 younes_mlik/hybrid-pagination 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

younes_mlik/hybrid-pagination

最新稳定版本:v0.0.1

Composer 安装命令:

composer require younes_mlik/hybrid-pagination

包简介

Hybrid pagination for Laravel.

README 文档

README

Laravel
PHP
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

✅ 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

composer require younes_mlik/hybrid-pagination

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

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?

Feature Offset Pagination Cursor Pagination Hybrid Pagination
Random page access
Performance on large datasets

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-23