elemenx/laravel-api-pagination 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

elemenx/laravel-api-pagination

最新稳定版本:0.1.6

Composer 安装命令:

composer require elemenx/laravel-api-pagination

包简介

API Pagination For Laravel & Lumen

README 文档

README

Inspired By Illuminate Pagination, This Package Used For Api Pagination (by limit/offset)

Changelog

  • 0.1.6 Fix Wrong Default Limit Value
  • 0.1.5 Fix Error When No Data
  • 0.1.4 Fix Typo.
  • 0.1.3 Fix Scope.
  • 0.1.2 Bump Version.
  • 0.1.1 Fix Unresolved Dependency.
  • 0.1.0 Init Version.

How to install (steps)

1. Install using Composer

composer require "elemenx/laravel-api-pagination"

2. Required changes in bootstrap/app.php (If using Lumen)

On bootstrap/app.php add:

$app->register(ElemenX\ApiPagination\PaginationServiceProvider::class);

3.Add Trait in Your Models

use ElemenX\ApiPagination\Paginatable;

class User {
    use Paginatable;
}

Example

This is an example for how to use this package.

$users = User::apiPaginate(100); // 100 is your defalut limit number

when you visit with

http://api.dev/user?limit=100&offset=0

It will return Structure As follows.

[
    'data' => [
        [
            'id' => 1,
            'name' => 'test'
        ]
    ],
    'meta' => [
        'limit' => 100,
        'offset' => 0,
        'total' => 1
    ]
]

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-21