PHPackages                             jackardios/scout-json-api-paginate - 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. [API Development](/categories/api)
4. /
5. jackardios/scout-json-api-paginate

ActiveLibrary[API Development](/categories/api)

jackardios/scout-json-api-paginate
==================================

Extension for https://github.com/spatie/laravel-json-api-paginate

00PHP

Since Oct 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Jackardios/scout-json-api-paginate)[ Packagist](https://packagist.org/packages/jackardios/scout-json-api-paginate)[ RSS](/packages/jackardios-scout-json-api-paginate/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

A paginator that plays nice with the JSON API spec
==================================================

[](#a-paginator-that-plays-nice-with-the-json-api-spec)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9df30f5f5c4ad55d1d868a6070dcc05afe77c78b9d5eec539806f9d8570eb35a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a61636b617264696f732f73636f75742d6a736f6e2d6170692d706167696e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jackardios/scout-json-api-paginate)[![Total Downloads](https://camo.githubusercontent.com/743906401d8dc23f477adb9d29c316da2aca7d27b72e7e57756a51a85d1a97ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61636b617264696f732f73636f75742d6a736f6e2d6170692d706167696e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jackardios/scout-json-api-paginate)

This package is just [Scout](https://github.com/laravel/scout) extension for [spatie/laravel-json-api-paginate](https://github.com/spatie/laravel-json-api-paginate)

In a vanilla Laravel application [the query builder paginators will listen to `page` request parameter](https://laravel.com/docs/master/pagination#paginating-query-builder-results). This works great, but it does follow the example solution of [the json:api spec](http://jsonapi.org/). That example [expects](http://jsonapi.org/examples/#pagination) the query builder paginator to listen to the `page[number]` and `page[size]` request parameters.

This package adds a `jsonPaginate` method to the Scout query builder that listens to those parameters and adds [the pagination links the spec requires](http://jsonapi.org/format/#fetching-pagination).

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

[](#installation)

You can install the package via composer:

```
composer require jackardios/scout-json-api-paginate
```

In Laravel 5.5 and above the service provider will automatically get registered. In older versions of the framework just add the service provider in `config/app.php` file:

```
'providers' => [
    ...
    Spatie\JsonApiPaginate\JsonApiPaginateServiceProvider::class,
    Jackardios\ScoutJsonApiPaginate\JsonApiPaginateServiceProvider::class,
];
```

Optionally you can publish the config file with:

```
php artisan vendor:publish --provider="Spatie\JsonApiPaginate\JsonApiPaginateServiceProvider" --tag="config"
```

This is the content of the file that will be published in `config/json-api-paginate.php`

```
