kilte/pagination

此包已被废弃,不再维护。作者建议使用amstaffix/pagination包。

简单分页

1.1.3 2016-01-26 16:30 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:31:50 UTC


README

简单分页

Downloads License

需求

  • 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'
    )
*/

注意:标签(如firstcurrent,...)在分页类中定义为常量(TAG_FIRSTTAG_CURRENT,...)。

测试

$ composer install
$ vendor/bin/phpunit

贡献

贡献流程

变更日志

变更日志

许可协议

MIT许可协议(MIT)