PHPackages                             acadea/collection-paginator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. acadea/collection-paginator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

acadea/collection-paginator
===========================

Laravel Package to paginate any collection

v1.0.1(5y ago)7265MITPHPPHP ^7.3

Since Oct 18Pushed 5y agoCompare

[ Source](https://github.com/acadea/collection-paginator)[ Packagist](https://packagist.org/packages/acadea/collection-paginator)[ Docs](https://github.com/acadea/collection-paginator)[ GitHub Sponsors](https://github.com/acadea)[ RSS](/packages/acadea-collection-paginator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Collection Paginator
====================

[](#collection-paginator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a3818078150c82dd838b24ea6d69e17a983a45df93aa287e5a51951049361f61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6163616465612f636f6c6c656374696f6e2d706167696e61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/acadea/collection-paginator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/391f40e27b7c4623c43b93142a315c85b7fe564d5250f3b82b7a84abde10e500/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6163616465612f636f6c6c656374696f6e2d706167696e61746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/acadea/collection-paginator/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/0ba760c9bb0f77e0c324e37de398808ccf71322f115484d18312454d6245d26c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6163616465612f636f6c6c656374696f6e2d706167696e61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/acadea/collection-paginator)

A helper package to paginate Laravel collections.

About
-----

[](#about)

Learn the idea behind this package:

- Read on my [Medium blog: How to Paginate Collection](https://medium.com/@sam_ngu/laravel-how-to-paginate-collection-8cb4b281bc55)
- or watch it on [Youtube](https://www.youtube.com/watch?v=eGEa9W6r3Zg)

Follow us on Youtube: [Acadea.io](https://www.youtube.com/channel/UCU5RsUGkVcPM9QvFHyKm1OQ)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require acadea/collection-paginator
```

Usage
-----

[](#usage)

```
$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);
```

Expects:

```
{
    "current_page": 1,
    "data": [
        1,
        2,
        3,
        4
    ],
    "first_page_url": "http://localhost:8000/api/fruits?page=1",
    "from": 1,
    "last_page": 2,
    "last_page_url": "http://localhost:8000/api/fruits?page=2",
    "links": [
        {
            "url": null,
            "label": "Previous",
            "active": false
        },
        {
            "url": "http://localhost:8000/api/fruits?page=1",
            "label": 1,
            "active": true
        },
        {
            "url": "http://localhost:8000/api/fruits?page=2",
            "label": 2,
            "active": false
        },
        {
            "url": "http://localhost:8000/api/fruits?page=2",
            "label": "Next",
            "active": false
        }
    ],
    "next_page_url": "http://localhost:8000/api/fruits?page=2",
    "path": "http://localhost:8000/api/fruits",
    "per_page": 4,
    "prev_page_url": null,
    "to": 4,
    "total": 8
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [sam-ngu](https://github.com/sam-ngu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Total

2

Last Release

1945d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/56226102?v=4)[Acadea](/maintainers/Acadea)[@acadea](https://github.com/acadea)

---

Top Contributors

[![sam-ngu](https://avatars.githubusercontent.com/u/30950704?v=4)](https://github.com/sam-ngu "sam-ngu (10 commits)")[![rgruberski](https://avatars.githubusercontent.com/u/4487397?v=4)](https://github.com/rgruberski "rgruberski (1 commits)")

---

Tags

acadeacollection-paginator

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/acadea-collection-paginator/health.svg)

```
[![Health](https://phpackages.com/badges/acadea-collection-paginator/health.svg)](https://phpackages.com/packages/acadea-collection-paginator)
```

###  Alternatives

[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[tonysm/rich-text-laravel

Integrates Trix content with Laravel

46577.8k1](/packages/tonysm-rich-text-laravel)[mauricius/laravel-htmx

Laravel helper library for Htmx

364101.1k1](/packages/mauricius-laravel-htmx)[illuminate/reflection

The Illuminate Reflection package.

361.6M3](/packages/illuminate-reflection)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[spatie/laravel-screenshot

Take screenshots of web pages in Laravel apps

7615.9k2](/packages/spatie-laravel-screenshot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
