定制 abdulrhman-developer0/php-datapaginator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

abdulrhman-developer0/php-datapaginator

最新稳定版本:v1.0

Composer 安装命令:

composer require abdulrhman-developer0/php-datapaginator

包简介

this using for split beg arrays to small arrays with pagination

README 文档

README

Installation

Use this command to install the package in your project.

    composer require abdulrhman-developer0/php-datapaginator

Simple Usge

Example:

<?php

    use AbdulrhmanDeveloper0\PhpDatapaginator\Paginator;

    // the dumy data to paginate.
    $items =  array_fill(0, 100, 'page item');

    // using the paginator.
    $paginator = new Paginator($items, 10);

    // get a specified page items.
    $page2 = $paginator->get(2);

Paginator

Example:

   $paginator = new Paginator($data, 20);

More about this class constructor:

    /**
     * Initialize the paginator class
     * 
     * @param array $items The data to split as pages.
     * @param int $itemsPerPage The count of items per page
     */
    public function __construct(array $items = [], int $itemsPerPage = 10)

Available Methods

In this part of the documentation we will learn about the methods available for use in this package.



    /**
     * Retrieve items for any page through the page index
     * 
     * @param int $pageNumber The page index
     * @return array The items of the page
     */
    public function get(int $pageNumber): array;
    /**
     * @return int|null Retunr the first page index if exists or null if not
     */
    public function getFirstPage(): int|null;
    /**
     * @return int|null Retunr the last page index if exists or null if not
     */
    public function getLastPage(): int|null;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-30