A small library to generate pagination.
composer require laasti/pagination
$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>';
- 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
See CHANGELOG.md for more information.
Author: Sonia Marquette (@nebulousGirl)
Released under the MIT License. See LICENSE.txt file.