承接 kgilden/pager 相关项目开发

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

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

kgilden/pager

最新稳定版本:v2.0.1

Composer 安装命令:

composer require kgilden/pager

包简介

A paginator library to split results into multiple pages

README 文档

README

Build Status Quality Packagist

Pager is a library to split results to multiple pages - any way you want them!

Features

  • 5 built-in adapters for arrays, Doctrine ORM, ElasticSearch & MongoDB;
  • safe subset of methods to not even count items;
  • strategies to split pages inequally (i.e. 2 last pages merged);
  • integrates nicely with Symfony's HttpKernel to infer the current page;
  • provides a bundle to seamlessly integrate with Symfony;

Documentation

Read the documentation

Usage

Two objects work together to split a set of items to pages: pager and adapter. Pagers act as factories for pages. Adapters allow concrete item sets to be paged (for example there's an adapter for Doctrine queries).

Here's an example with arrays (check out the docs for more):

<?php

use KG\Pager\Pager;
use KG\Pager\Adapter\ArrayAdapter;

$list = ['apple', 'banana', 'cucumber', 'dragonfruit', 'eggplant'];
$itemsPerPage = 2;
$currentPage = 3;

$pager = new Pager();
$page = $pager->paginate(new ArrayAdapter($list), $itemsPerPage, $currentPage);

$page->isFirst(); // false
$page->isLast(); // true - there's a total of 3 pages
$page->getNumber(); // 3 - it's $currentPage

count($page->getItems()); // 1
$page->getItems(); // ["eggplant"]

?>

Installation

Install using composer: composer.phar require kgilden/pager

Testing

Simply run phpunit in the root directory of the library for the full test suite.

License

This library is under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固