Download the PHP package jackardios/laravel-json-api-paginate without Composer
On this page you can find all versions of the php package jackardios/laravel-json-api-paginate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jackardios/laravel-json-api-paginate
More information about jackardios/laravel-json-api-paginate
Files in jackardios/laravel-json-api-paginate
Package laravel-json-api-paginate
Short Description A paginator that plays nice with the JSON API spec
License MIT
Homepage https://github.com/jackardios/laravel-json-api-paginate
Informations about the package laravel-json-api-paginate
A paginator that plays nice with the JSON API spec
In a vanilla Laravel application the query builder paginators will listen to page
request parameter. This works great, but it does follow the example solution of the json:api spec. That example expects the query builder paginator to listen to the page[number]
and page[size]
request parameters.
This package adds a jsonPaginate
method to the Eloquent query builder that listens to those parameters and adds the pagination links the spec requires.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install the package via composer:
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:
Optionally you can publish the config file with:
This is the content of the file that will be published in config/json-api-paginate.php
Usage
To paginate the results according to the json API spec, simply call the jsonPaginate
method.
Of course you may still use all the builder methods you know and love:
By default the maximum page size is set to 30. You can change this number in the config
file or just pass the value to jsonPaginate
.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Freek Van der Herten
- All Contributors
The base code of this page was published on this Laracasts forum thread by Joram van den Boezem
License
The MIT License (MIT). Please see License File for more information.