zver/pagination 问题修复 & 功能扩展

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

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

zver/pagination

Composer 安装命令:

composer require zver/pagination

包简介

this is universal pagination package

README 文档

README

Universal pagination class

Install

composer require zver/pagination

Usage

<?php

use Zver\Pagination;

Pagination::create()
          
          /**
          * Array or PaginationInterface implemented class
          */
          ->setItems([1,2,3,4,5,6])
          
          /**
          * Items per page
          */
          ->setItemsPerPage(20)
          
          /**
          * Here you must define URL generation callback.
          */
          ->setPageUrlCallback(
              function ($number)
              {
                  /**
                  * For example
                  */
                  return "/items?page=" . $number;
              }
          )
          
          /**
          * Here you must define callback which returns current page number.
          */
          ->setCurrentPageCallback(
              function ()
              {
                  /**
                  * For example
                  */
                  
                  if(isset($_GET['page']) && is_numeric($_GET['page']))
                  {
                    return $_GET['page'];
                  }
                  
                  return 1;
              }
          )
          
          /**
          * Here you can render items html as you want.
          */
          ->showItems(
              function ($items, Pagination $pagination)
              {
                  
              }
          )
          
          /**
          * Here you can render pages html as you want.
          * Callback will executed only if pages count > 1
          */
          ->showPages(
              function ($pages, Pagination $pagination)
              {
                 
              }
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-07-30