Make Laravel Pagination works with array

v1.0.0 2020-10-30 00:45 UTC

This package is auto-updated.

Last update: 2022-07-29 02:04:33 UTC


Avoid waste time creating your own paginator and use this package for paginate your array in Laravel.


composer require laravel-array-pagination

How to use

use Andrepgsilva\LaraArrayPagination\Classes\ArrayPaginator;

$fruits = ['orange', 'apple', 'watermelon', 'banana'];

$paginator = new ArrayPaginator();
// That's it!
$paginatedContent = $paginator->paginate($fruits);

Custom pagination

// You can pass the number of page results. The default is 3.
// Even the URL path that you want use
$paginator->paginate($fruits, $perPage = 3, ['path' => '']);