PHPackages                             sammyt/paginate-collection - 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. sammyt/paginate-collection

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

sammyt/paginate-collection
==========================

Allows laravel users to paginate a collection via a global helper method. Currently laravel only allows for native query builder pagination.

v1.0.1(4y ago)11.1kMITPHP

Since Oct 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/torressam333/paginate-laravel-collection)[ Packagist](https://packagist.org/packages/sammyt/paginate-collection)[ RSS](/packages/sammyt-paginate-collection/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Laravel Paginate Collection
===========================

[](#laravel-paginate-collection)

Description:

Allows laravel users to paginate a collection via a global helper method. Currently laravel only allows for native query builder pagination.

Usage:

As a simple inline example I created a fresh Laravel project using: `laravel new MyProject`

In `MyProject`:

1. Set up an `.env` file which connects to a local database.
2. Run the out-of-the-box migrations making sure the `users` table is created.
3. Use `tinker` to create some test users in the `users` table or create them manually in your DB

To test you can call this method globally and pass in your collection. Other method parameters are optional. Accepted parameters include:

1. `$collection` =&gt; Required
2. `$perPage` =&gt; Default is 15 but also accepts an `int`
3. `$currentPage` =&gt; Default is null but also accepts an `int`
4. `$options` =&gt; Any additional options you wish to pass

Below is an example use case of how to use the `paginate_collection` global helper method.

Follow steps 1-3 above and then create a route in `web.php` which has a callback `function` which will allow you to return a collection for testing

```
Route::get('/users', function() {
   $userCollection = User::all();

   $paginatedUsersCollection = paginate_collection(
       $userCollection,
       10,
       null
   );

   dd($paginatedUsersCollection);
});

```

Output

```
Illuminate\Pagination\LengthAwarePaginator {#251 ▼
  #total: 2
  #lastPage: 1
  #items: Illuminate\Support\Collection {#265 ▶}
  #perPage: 10
  #currentPage: 1
  #path: "/"
  #query: []
  #fragment: null
  #pageName: "page"
  +onEachSide: 3
  #options: []
}

```

As you can see it uses the `LengthAwarePaginator` behind the scenes and your collection is now paginated.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1687d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5842703e192623ca279ec0699ec455051e7fa459e09c728da311291c61df8fd0?d=identicon)[torressam333](/maintainers/torressam333)

---

Top Contributors

[![torressam333](https://avatars.githubusercontent.com/u/33882985?v=4)](https://github.com/torressam333 "torressam333 (2 commits)")

### Embed Badge

![Health badge](/badges/sammyt-paginate-collection/health.svg)

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

###  Alternatives

[illuminate/conditionable

The Illuminate Conditionable package.

9043.1M32](/packages/illuminate-conditionable)[leedavis81/vent

PHP variable events.

814.6k](/packages/leedavis81-vent)[codingfreaks/cf-cookiemanager

Manage cookies, scripts, and GDPR compliance on your Typo3 website with CodingFreaks Typo3 Cookie Manager. Customize cookie banners, streamline workflow, and enhance user experience. Ensure GDPR compliance and take control of cookie management with our Typo3 cookie management extension. Visit the official Typo3 Documentation page to learn more.

1625.8k](/packages/codingfreaks-cf-cookiemanager)

PHPackages © 2026

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