项目作者: omerkamcili

项目描述 :
PHP Calculate pages with take, skip and total parameters and then create pagination links. Php pagination package.
高级语言: PHP
项目地址: git://github.com/omerkamcili/pagination.git
创建时间: 2019-12-13T08:27:08Z
项目社区:https://github.com/omerkamcili/pagination

开源协议:

下载


OmerKamcili\Pagination

Calculate and create urls from take, skip and total parameters for pagination.

Install

Install package with composer

  1. composer install omerkamcili\pagination

Example

  1. $data = [
  2. 'total' => 359,
  3. 'skip' => 20,
  4. 'url' => 'http://www.yourapp.com/currentPage',
  5. ];
  6. $pagination = new \OmerKamcili\Pagination\Pagination($data);
  7. print_r($pagination);
  8. foreach($pagination->pages as $page => $url){
  9. echo "Page $page: $url";
  10. }

Parameters

All parameters public, you can access from outside and you can set with construct method

Parameter Type Description
take integer Set take parameter
skip integer Set skip parameter
total integer Set total parameter
url string Set url for use about pagination
currentPage integer Will be calculated auto
totalPages integer Will be calculated auto
takeLabel string You can change take name ( for example limit )
skipLabel string You can change skip name ( for example offset )
nextPage string Will be created auto ( not implemented )
previousPage string Will be created auto ( not implemented )
firstPage string Will be created auto ( not implemented )
lastPage string Will be created auto ( not implemented )
pages array Will be created pages, you can iterate the created pages
walkPageNumber integer Number of pagination item, ( default 3 meanings 11 - 12 - 13 - [14] - 15 - 16 - 17 )

Contributing

You can create merge request or you can create issue card, there is no rules about this.