Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-jsonapi-paginator maintained by ezavalishin

Description
:package_description
Last update
2020/10/23 00:15 (dev-master)
License
Downloads
10

Comments
comments powered by Disqus

laravel-jsonapi-paginator

Latest Version on Packagist Total Downloads StyleCI Codecov Travis (.com)

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require ezavalishin/laravel-jsonapi-paginator

Optionally you can publish the config file with:

$ php artisan vendor:publish --provider="ezavalishin/LaravelJsonApiPaginator\LaravelJsonApiPaginatorServiceProvider" --tag="config"

Usage

To paginate the results according to the json API spec, simply call the jsonPaginate method.

YourModel::jsonApiPaginate();

Of course you may still use all the builder methods you know and love:

YourModel::where('my_field', 'myValue')->jsonApiPaginate();

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.

$maxResults = 60;

YourModel::jsonApiPaginate($maxResults);

Offset based pagination

Supports: ?page[offset] and ?page[limit]

Page based pagination

Supports: ?page[number] and ?page[size]

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email ezavalishin@gmail.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.