anzubko/swf-paginator
Composer 安装命令:
composer require anzubko/swf-paginator
包简介
Simplest framework pagination calculator
README 文档
README
This class intended for organization of page-by-page navigation on some data. Basically intended for construction of page-by-page navigation panels on websites.
Installation
composer require anzubko/swf-paginator
Usage
use SWF\Paginator; $p = new Paginator( $totalEntries, // total number of entries (>=1) $entriesPerPage, // number of entries per page (>=1) $pagesPerSet, // number of pages per set (>=1) $currentPage, // current number of page ); // Get some property directly $p->totalEntries; // Or by method call $p->getTotalEntries();
Properties
Slice params
-
$p->startOfSlice - start position of the slice (>=0)
-
$p->endOfSlice - end position of the slice (>=0)
-
$p->lengthOfSlice - length of the slice (>=1)
Statistics
-
$p->totalEntries - total number of entries (>=1) (copied from arguments)
-
$p->entriesPerPage - number of entries per page (>=1) (copied from arguments)
-
$p->pagesPerSet - number of pages per set (>=1) (copied from arguments)
Pages control
-
$p->totalPages - total number of pages (>=1)
-
$p->currentPage - current number of page (>=1) (copied from arguments and corrected)
-
$p->prevPage - previous number of page (>=1 or null)
-
$p->nextPage - next number of page (>=1 or null)
Pages set control
-
$p->startOfSet - start position of current set (>=1)
-
$p->endOfSet - end position of current set (>=1)
-
$p->pageOfPrevSet - nearest page number of the previous set (>=1 or null)
-
$p->pageOfNextSet - nearest page number of the next set (>=1 or null)
-
$p->numbersOfSet - numbers of set (one or more numbers >=1 in array)
Examples
Simple
<-- previous page | next page -->
/ \
$p->prevPage $p->nextPage
Advanced
$p->currentPage
|
$p->prevPage | $p->nextPage
\ | /
<< < 6 [7] 8 9 10 > >>
/ / \ \
$p->pageOfPrevSet / \ $p->pageOfNextSet
/ \
$p->startOfSet $p->endOfSet
| |
[ $p->numbersOfSet ]
Statistics
$p->totalPages
/ $p->totalEntries
Total pages: 20 /
Total records: 200
Shown from 61 to 70 records
\ \
\ $p->startOfSlice + 1
$p->endOfSlice + 1
Notes
-
Most simple way to check, needs to show navigation panel or not, is checking $p->totalPages property. Needs only, if this property > 1.
-
$p->prevPage, $p->nextPage, $p->pageOfPrevSet and $p->pageOfNextSet properties must be checked for null before using.
anzubko/swf-paginator 适用场景与选型建议
anzubko/swf-paginator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 166 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 anzubko/swf-paginator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 anzubko/swf-paginator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 166
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-03-24