Download the PHP package xandros15/slim-pagination without Composer
On this page you can find all versions of the php package xandros15/slim-pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package slim-pagination
SlimPagination
simple pagination for slim3
Requirements
PHP 7.0 or higher
Slim 3.0
Installation
via composer:
composer require xandros15/slim-pagination
Basic Usage
Create a object of pagination inside of controller callback, fetch it into string via renderer and pass it as variable:
Them render if via template manager.
PHP template example
Twig template example
Options
| Name | Info | Default | More |
|---|---|---|---|
Pagination::OPT_TOTAL |
set to total of items | (int) 1 | - |
Pagination::OPT_PARAM_NAME |
set param name | (string) page |
?page=2 or route /[{page:\d+}] has param name: page |
Pagination::OPT_PARAM_TYPE |
set param type (e.g via query or attribute) | PageList::PAGE_QUERY |
PageList::PAGE_QUERY for: ?page=2 PageList::PAGE_ATTRIBUTE for: /page/2 |
Pagination::OPT_PER_PAGE |
set how many items should be show on one page | (int) 10 | - |
Pagination::OPT_SIDE_LENGTH |
set how many buttons should be show before slider | (int) 3 | - |
Pagination::OPT_LIST_TYPE |
set type of list | PageList::NORMAL |
available:PageList::NORMAL;PageList::MINIPageList::NONE |
PageList Type:
PageList::NORMAL is normal pagination with slider:

PageList::MINI is minimalistic pagination:

can be created by simple code:
twig
php
PageList::NONE turns off pagination
Methods and Attributes
Page
pathFor - returning path for this page
isCurrent - check if this page is current
pageName - returning page name (e.g. number)
isSlider - check if this page is slider
Pagination
previous() - getting previous page, if doesn't exist returning current
next() - getting next page, if doesn't exist returning current
first() - getting first page
last() - getting last page
canCreate() - checking if pagination can be create
toArray() - returning array of defined params:
- per_page: how many items on one page
- current_page: number of current page
- next_page_url: path for next page
- prev_page_url: path for previous page
- from: number of first item
- to: number of last item
toJson() - same as toArray(), just compile to json string