PHPackages                             vipertecpro/laravel-pretty-pagination - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vipertecpro/laravel-pretty-pagination

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vipertecpro/laravel-pretty-pagination
=====================================

Laravel SEO friendly pagination routing.

24.7k1PHP

Since Jul 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vipertecpro/laravel-pretty-pagination)[ Packagist](https://packagist.org/packages/vipertecpro/laravel-pretty-pagination)[ RSS](/packages/vipertecpro-laravel-pretty-pagination/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 6.*|7.*|8.\* : Laravel Pretty Pagination
================================================

[](#laravel-678--laravel-pretty-pagination)

[![Latest Stable Version](https://camo.githubusercontent.com/5de36423d8f87232dbcbde40e3cd7d924bf7954a99d2257a16a6a3791e7c246b/68747470733a2f2f706f7365722e707567782e6f72672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f762f737461626c65)](https://packagist.org/packages/vipertecpro/laravel-pretty-pagination)[![Total Downloads](https://camo.githubusercontent.com/6d37afe6077a1575be7df72eed3f3ddac43ad0bbff59159ab5685331d03034f8/68747470733a2f2f706f7365722e707567782e6f72672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/vipertecpro/laravel-pretty-pagination)[![Build Status](https://camo.githubusercontent.com/59e76a8e422750f1e63a8f72a1f2c6634770ffee41c7741618abe2b4bf0864c1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vipertecpro/laravel-pretty-pagination/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d558f12a1818be4ce9c76e93d8bf0a3fb125edbc08af54d9b6f894b757b81e09/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vipertecpro/laravel-pretty-pagination/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/cf87531fa68578dcb82ddef4e632cf16fdd927e7d8e245308cebbb870352ccc3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![License](https://camo.githubusercontent.com/ae8a01bd8b84e5533da3673fbbb31e1b0dea96d58ece92e2e41e7b2c1ac38172/68747470733a2f2f706f7365722e707567782e6f72672f766970657274656370726f2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6c6963656e7365)](https://packagist.org/packages/vipertecpro/laravel-pretty-pagination)

This package adds the `paginate` route method to support pagination via custom routes instead of query strings. This also allows for easily translatable pagination routes ex. `/news/page/2`, `/nieuws/pagina/2`.

Install
-------

[](#install)

Via Composer

```
composer require vipertecpro/laravel-pretty-pagination
```

First register the service provider and facade in your application.

```
// config/app.php

'providers' => [
    ...
    'Vipertecpro\PaginateRoute\PaginateRouteServiceProvider',
];

'aliases' => [
    ...
    'PaginateRoute' => 'Vipertecpro\PaginateRoute\PaginateRouteFacade',
];
```

Then register the macros in `App\Providers\RouteServiceProvider::boot()`.

```
// app/Providers/RouteServiceProvider.php

use Vipertecpro\PaginateRoute\PaginateRouteFacade as PaginateRoute;

// ...

public function boot()
{
    PaginateRoute::registerMacros(); // Add this line

    parent::boot();
}
```

Usage
-----

[](#usage)

The `paginate` route macro will register two routes for you.

```
// app/Http/routes.php

// Generates /users & /users/page/{page}
Route::paginate('users', 'UsersController@index');
```

In your route's action you can just use Laravel's regular pagination methods.

```
// app/Http/Controllers/UsersController.php

public function index()
{
    return view('users.index', ['users' => \App\User::simplePaginate(5)]);
}
```

If you want to customize or add translations for the "page" url segment, you can publish the language files.

```
php artisan vendor:publish --provider="Vipertecpro\PaginateRoute\PaginateRouteServiceProvider"
```

### Generating Url's

[](#generating-urls)

Since Laravel's paginator url's will still use a query string, PaginateRoute has it's own url generator and page helper functions.

```

@if(PaginateRoute::hasPreviousPage())
  Previous
@endif

@if(PaginateRoute::hasNextPage($users))
  Next
@endif

```

The `nextPage` functions require the paginator instance as a parameter, so they can determine whether there are any more records.

```
/**
 * @param  \Illuminate\Contracts\Pagination\Paginator $paginator
 * @return int|null
 */
public function nextPage(Paginator $paginator)
```

```
/**
 * @param  \Illuminate\Contracts\Pagination\Paginator $paginator
 * @return bool
 */
public function hasNextPage(Paginator $paginator)
```

```
/**
 * @param  \Illuminate\Contracts\Pagination\Paginator $paginator
 * @return string|null
 */
public function nextPageUrl(Paginator $paginator)
```

```
/**
 * @return int|null
 */
public function previousPage()
```

```
/**
 * @return bool
 */
public function hasPreviousPage()
```

```
/**
 * @param  bool $full
 * @return string|null
 */
public function previousPageUrl($full = false)
```

```
/**
 * @param int  $page
 * @param bool $full
 * @return string
 */
public function pageUrl($page, $full = false)
```

If `$full` is true, the first page will be a fully qualified url. Ex. `/users/page/1` instead if just `/users` (this is the default).

To retrieve the url of a specific page of a paginated route, that isn't the current route, there's the `addPageQuery` function.

```
/**
 * @param string $url
 * @param int $page
 * @param bool $full
 * @return string
 */
public function addPageQuery($url, $page, $full = false)
```

You can also retrieve an array with all available urls. These can be rendered as a plain html list with page numbers. Note that these functions require a `LengthAwarePaginator`.

```
/**
 * @param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
 * @param  bool $full
 * @return array
 */
public function allUrls(LengthAwarePaginator $paginator, $full = false)
```

```
/**
 * @param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
 * @param  bool $full
 * @param  string $class
 * @param  bool $additionalLinks
 * @return string
 */
public function renderPageList(LengthAwarePaginator $paginator, $full = false, $class = null, $additionalLinks = false)
```

```
/**
 * Example : {!! PaginateRoute::renderPageList($items,true,'pagination',true) !!}
 */

    1
    2
    3
    4
    &raquo;

```

You can render link tags to mark previous and next page for SEO. Note that these functions require a `LengthAwarePaginator`.

```
/**
 * @param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
 * @param  bool $full
 * @return string
 */
public function renderRelLinks(LengthAwarePaginator $paginator, $full = false)
```

```

```

Tests
-----

[](#tests)

The package contains some integration/smoke tests, set up with Orchestra. The tests can be run via phpunit.

```
$ phpunit

```

Comming Soon
------------

[](#comming-soon)

- Bootstrap 4.\* supported pagination rendering.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d3a3b2ba846f1bfba4abffbad69672bad88c8488d1c9f5d6dbb7d6c802cd0c3?d=identicon)[vipertecpro](/maintainers/vipertecpro)

---

Top Contributors

[![vipertecpro](https://avatars.githubusercontent.com/u/11619188?v=4)](https://github.com/vipertecpro "vipertecpro (1 commits)")

### Embed Badge

![Health badge](/badges/vipertecpro-laravel-pretty-pagination/health.svg)

```
[![Health](https://phpackages.com/badges/vipertecpro-laravel-pretty-pagination/health.svg)](https://phpackages.com/packages/vipertecpro-laravel-pretty-pagination)
```

###  Alternatives

[andrewcarteruk/cryptokey

A command line tool for generating keys using a CSPRNG.

6124.2k](/packages/andrewcarteruk-cryptokey)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
