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
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-30