PHPackages                             ryanwinchester/laravel-paginates - 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. ryanwinchester/laravel-paginates

ActiveLibrary

ryanwinchester/laravel-paginates
================================

Laravel controller trait for paginating models

v1.1.0(8y ago)2472Apache-2.0PHPPHP &gt;=7.0

Since Oct 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ryanwinchester/laravel-paginates)[ Packagist](https://packagist.org/packages/ryanwinchester/laravel-paginates)[ RSS](/packages/ryanwinchester-laravel-paginates/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

PaginatesModels
===============

[](#paginatesmodels)

[![Packagist](https://camo.githubusercontent.com/c37a3f6924753578ad0361e4045fb747d59bec95ae5867109ea06a8fef7a4c3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f7279616e77696e636865737465722f6c61726176656c2d706167696e617465732e7376673f6d61784167653d32353932303030)](https://packagist.org/packages/ryanwinchester/laravel-paginates)[![Packagist](https://camo.githubusercontent.com/74322984af7a4ac393e740b242737c28e9997a67d23262993279b3897268bee0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7279616e77696e636865737465722f6c61726176656c2d706167696e617465732e7376673f6d61784167653d32353932303030)](https://packagist.org/packages/ryanwinchester/laravel-paginates)

This trait adds a super duper handy method that will give you behaviour from requests slightly similar to what something like `league/fractal` gives you without all the setup and needing to create transformers.

Between this trait, and Eloquent Models' `$casts` and `$hidden` properties, starting a basic API with about as much control as some more *heavyweight* packages give you, will be really quick.

Install
-------

[](#install)

```
composer require ryanwinchester/laravel-paginates

```

Usage
-----

[](#usage)

Add it to your controller (or base controller, as shown):

```
// ...
use RyanWinchester\Paginates\PaginatesModels;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests, PaginatesModels;
}
```

Then use it in your controller methods like so:

```
class ProductsController extends Controller
{
    public function index()
    {
        $products = $this->paginate(Product::class);

        return response()->json($products);
    }
}
```

Sometimes because of security or privacy, you may want to limit `include` relationships and/or `columns`. If that is the case, then be sure to include the parameters you want, making sure to exclude any user-supplied include parameters.

```
$products = $this->paginate(
    Product::class,
    $request->except(['include', 'columns'])
);
```

Or, say you want to define some included relationships yourself:

```
$products = $this->paginate(
    Product::with('variations'),
    $request->except(['include', 'columns'])
);
```

Or, even limit to specific columns:

```
$products = $this->paginate(
    Product::select(['id', 'price', 'in_stock']),
    $request->except('columns')
);
```

You can pass in any builder instance or a model class name.

### Parameters:

[](#parameters)

- **page** : `page=3` the page number
- **perPage** : `perPage=10` amount to show per page
- **columns** : `columns=title,body,author` limit to certain columns
- **include** : `include=categories,tags` load relations
- **orderBy** : `orderBy=published|desc` order the items by a column and direction

In action
---------

[](#in-action)

Then you can go to your route and add some of these optional parameters to page and filter: [![url](https://camo.githubusercontent.com/4ddfd8e41fc2b2b6a7933f9033d8bfa387fd10e18f0e5d8d3c108a437331649f/687474703a2f2f732e7279616e77696e636865737465722e63612f323234313379316c327a33612f53637265656e73686f74253230323031362d31302d303325323032302e33352e34362e706e67)](https://camo.githubusercontent.com/4ddfd8e41fc2b2b6a7933f9033d8bfa387fd10e18f0e5d8d3c108a437331649f/687474703a2f2f732e7279616e77696e636865737465722e63612f323234313379316c327a33612f53637265656e73686f74253230323031362d31302d303325323032302e33352e34362e706e67)

[![response](https://camo.githubusercontent.com/8d5a28656d3cfe4d3abf77ed59fd027d94493af4980cdccc79e914a75ef70829/687474703a2f2f732e7279616e77696e636865737465722e63612f306d337830333035313131712f53637265656e73686f74253230323031362d31302d303325323032302e30372e31302e706e67)](https://camo.githubusercontent.com/8d5a28656d3cfe4d3abf77ed59fd027d94493af4980cdccc79e914a75ef70829/687474703a2f2f732e7279616e77696e636865737465722e63612f306d337830333035313131712f53637265656e73686f74253230323031362d31302d303325323032302e30372e31302e706e67)

Please try it out and give feedback.
====================================

[](#please-try-it-out-and-give-feedback)

[Taylor thinks it's a good idea](https://github.com/laravel/framework/pull/15741), so I mean what other reason do you need?

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~133 days

Total

4

Last Release

3108d ago

Major Versions

v0.3.3 → v1.0.02017-10-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/f839bc1a48d9699534fdfd618ad477afe371e9ce70c76885a5cb851895ab7289?d=identicon)[ryanwinchester](/maintainers/ryanwinchester)

---

Top Contributors

[![ryanwinchester](https://avatars.githubusercontent.com/u/2897340?v=4)](https://github.com/ryanwinchester "ryanwinchester (19 commits)")

---

Tags

laravellaravel-packagelaravel-paginationlaravel-paginatorphp

### Embed Badge

![Health badge](/badges/ryanwinchester-laravel-paginates/health.svg)

```
[![Health](https://phpackages.com/badges/ryanwinchester-laravel-paginates/health.svg)](https://phpackages.com/packages/ryanwinchester-laravel-paginates)
```

PHPackages © 2026

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