danbovey/laravel-linkheader-paginator
Larablocks Analysis
danbovey/laravel-linkheader-paginator works with any PHP project: the latest release (1.0.1, Nov 6, 2016) doesn't depend on Laravel.
Laravel 5 in earlier releases.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Nov 6, 2016)
- 5 downloads a month (needs 10,000)
- 3 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Nov 6, 2016.
- No releases in the last 12 months.
- First released: Nov 6, 2016.
- Monthly downloads: 5, up 150% from six months ago.
- 2 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.
| Install | |
|---|---|
composer require danbovey/laravel-linkheader-paginator |
|
| Latest Version: | 1.0.1 |
| Older releases: | 5 |
| License: | MIT |
| Last Updated: | Nov 8, 2016 |
| Links: | GitHub · Packagist |
Laravel LinkHeader Paginator
A custom Laravel/Lumen Paginator that uses the Link header (RFC 5988) to send pagination info in the response. Removes the envelope around data!
Adds a method called toResponse that returns a JSON response with headers. The getHeaders method exists if you need different response data.
Installation
$ composer require danbovey/laravel-linkheader-paginator
Usage
Create the pagination with the Eloquent/DB Builder and pass it to the LengthAwarePaginator.
$items = User::where('active', 1)->paginate(20);
$paginator = new LengthAwarePaginator($items);
return $paginator->toResponse();
"Simple Pagination"
The simple paginator does not need to know the total number of items in the result set; however, because of this, the class does not return the URI of the last page.
Ironically, the simple paginator is more work using this library. To save on queries you should skip using the methodsimplePaginate, and implement the skip/take logic yourself.
$page = $request->get('page');
$perPage = 20;
// Take one more than needed to see if there is a next page
$users = User::skip(($page - 1) * $perPage)
->take($perPage + 1);
$paginator = new Paginator($simple, $items);
return $paginator->toResponse();
Alternatives to danbovey/laravel-linkheader-paginator
Create a Laravel Paginator or LengthAwarePaginator from a Redis sorted set
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| 1.0.1 | MIT | ||
| 1.0.0 | ^5.3 | MIT |