library pagination
this is universal package template for development and testing and composer distribution
zver/pagination
this is universal package template for development and testing and composer distribution
- Tuesday, May 2, 2017
- by s4urp8n
- Repository
- 1 Watchers
- 0 Stars
- 11 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 0 % Grown
Universal pagination class, (*1)
Install
composer require zver/pagination
Usage
<?php
use Zver\Pagination;
Pagination::create()
/**
* Array or PaginationInterface implemented class
*/
->setItems([1,2,3,4,5,6])
/**
* Items per page
*/
->setItemsPerPage(20)
/**
* Here you must define URL generation callback.
*/
->setPageUrlCallback(
function ($number)
{
/**
* For example
*/
return "/items?page=" . $number;
}
)
/**
* Here you must define callback which returns current page number.
*/
->setCurrentPageCallback(
function ()
{
/**
* For example
*/
if(isset($_GET['page']) && is_numeric($_GET['page']))
{
return $_GET['page'];
}
return 1;
}
)
/**
* Here you can render items html as you want.
*/
->showItems(
function ($items, Pagination $pagination)
{
}
)
/**
* Here you can render pages html as you want.
* Callback will executed only if pages count > 1
*/
->showPages(
function ($pages, Pagination $pagination)
{
}
);
dev-master
9999999-dev
this is universal package template for development and testing and composer distribution
Sources
Download
The Requires
1.0.3
1.0.3.0
this is universal package template for development and testing and composer distribution
Sources
Download
The Requires
1.0.2
1.0.2.0
this is universal package template for development and testing and composer distribution
Sources
Download
The Requires