ecommit / paginator
创建分页器。
v1.1.0
2023-12-23 18:39 UTC
Requires
- php: ^8.0
- symfony/options-resolver: ^5.4|^6.4|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-21 18:01:34 UTC
README
创建分页器。
安装
要使用Composer安装paginator,只需运行
$ composer require ecommit/paginator
用法
use Ecommit\Paginator\ArrayPaginator; //Create a paginator $paginator = new ArrayPaginator([ //Options 'page' => 1, 'max_per_page' => 100, 'data' => ['val1', 'val2', 'val3'], //Or with an ArrayIterator //'data' => new \ArrayIterator(['val1', 'val2', 'val3']), ]); $totalPages = $paginator->getLastPage(); $countRows = \count($paginator); foreach ($paginator as $result) { //... }
可用选项
可用方法
查看API文档
许可证
此库采用MIT许可证。完整的许可证内容请见LICENSE文件。