PHPackages                             jackardios/elastic-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. jackardios/elastic-json-api-paginate

ActiveLibrary

jackardios/elastic-json-api-paginate
====================================

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

0121PHP

Since Oct 12Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

This package is just [ElasticScoutDriverPlus](https://github.com/Jackardios/elastic-scout-driver-plus/) 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/elastic-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\ElasticJsonApiPaginate\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`

```
