kilte / pagination
1.1.3
2016-01-26 16:30 UTC
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: ~4.7
This package is not auto-updated.
Last update: 2022-02-01 12:31:50 UTC
README
简单分页
需求
- PHP >= 5.3.3
用法
use Kilte\Pagination\Pagination; $pagination = new Pagination($totalItems, $currentPage, $itemsPerPage, $neighbours); $offset = $pagination->offset(); $limit = $pagination->limit(); $listing = $someInstance->listing($offset, $limit); $pages = $pagination->build(); // Contains associative array with a numbers of a pages // For example: /* array( 1 => 'first', 5 => 'less', 6 => 'previous', // This interval 7 => 'previous', // is defined 8 => 'previous', // by 9 => 'previous', // $neighbours argument 10 => 'current', // Current page 11 => 'next', 12 => 'next', 13 => 'next', 14 => 'next', 15 => 'more', 20 => 'last' ) */
注意:标签(如first,current,...)在分页类中定义为常量(TAG_FIRST
,TAG_CURRENT
,...)。
测试
$ composer install $ vendor/bin/phpunit
贡献
变更日志
许可协议
MIT许可协议(MIT)