laasti / pagination
A small pagination library that produces data objects instead of HTML.
v0.2.2
2016-01-15 22:08 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- league/container: ~1.3
README
A small library to generate pagination.
Installation
composer require laasti/pagination
Usage
$pagination = new Pagination($currentPage, $total, $perPage, $baseUrl, $neighbours); echo '<a href="'.$pagination->first()->link().'">First</a>'; echo '<a href="'.$pagination->previous()->link().'">Previous</a>'; foreach ($pagination as $page) { if ($page->isActive()) { echo '<b>'.$page->number().'</b>'; } else { echo '<a href="'.$page->link().'">'.$page->number().'</a>'; } } echo '<a href="'.$pagination->next()->link().'">Next</a>'; echo '<a href="'.$pagination->last()->link().'">Last</a>';
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
See CHANGELOG.md for more information.
Credits
Author: Sonia Marquette (@nebulousGirl)
License
Released under the MIT License. See LICENSE.txt file.