PHP code example of acadea / collection-paginator
1. Go to this page and download the library: Download acadea/collection-paginator 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/ */
acadea / collection-paginator example snippets
$collection = collect([1,2,3,4,5,6,7,8]);
$pageSize = 4;
$paginated = \Acadea\CollectionPaginator\CollectionPaginator::paginate($collection, $pageSize);
// ..
// in resource controller, returning as an api response
return new \Illuminate\Http\JsonResponse($paginated);