PHP code example of andrepgsilva / lara-array-pagination

1. Go to this page and download the library: Download andrepgsilva/lara-array-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andrepgsilva / lara-array-pagination example snippets


use Andrepgsilva\LaraArrayPagination\Classes\ArrayPaginator;

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

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

// 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']);