andrepgsilva/lara-array-pagination

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


README

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

Installation

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' => 'http://example.com']);