PHPackages                             web-ruslan/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. web-ruslan/laravel-pretty-pagination

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

web-ruslan/laravel-pretty-pagination
====================================

Laravel SEO friendly pagination routing.

v1.2.5(4y ago)015MITPHPPHP ^7.1.3|^8

Since Jan 1Pushed 4y agoCompare

[ Source](https://github.com/web-ruslan/laravel-pretty-pagination)[ Packagist](https://packagist.org/packages/web-ruslan/laravel-pretty-pagination)[ Docs](https://github.com/web-ruslan/laravel-pretty-pagination)[ RSS](/packages/web-ruslan-laravel-pretty-pagination/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (12)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/562b825d745c46b73fb4aa4926080b0a378130aed851785686ba1c3da91390b3/68747470733a2f2f706f7365722e707567782e6f72672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f762f737461626c65)](https://packagist.org/packages/web-ruslan/laravel-pretty-pagination)[![Total Downloads](https://camo.githubusercontent.com/085b81be6ec844523b3380600b1b71680dbcb4702faaea99dce5dfa3f4458e19/68747470733a2f2f706f7365722e707567782e6f72672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/web-ruslan/laravel-pretty-pagination)[![Build Status](https://camo.githubusercontent.com/8c3448db1a468776154251b8f53e5c3aaeca3ee79e18007d6892cbf38a0f9c99/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/web-ruslan/laravel-pretty-pagination/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7344407d03d26a1eb28a684caf5df1dbfd3a4e5830100775c8b06c4d1964f428/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/web-ruslan/laravel-pretty-pagination/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/85661cf96449ebe52d99ca416a4a5f73be197963657433e6be82acf2a2ee6fdc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![License](https://camo.githubusercontent.com/015a1640881ec20e504652da2ef021984af5287a8e701cbfa3f57362e73a733e/68747470733a2f2f706f7365722e707567782e6f72672f7765622d7275736c616e2f6c61726176656c2d7072657474792d706167696e6174696f6e2f6c6963656e7365)](https://packagist.org/packages/web-ruslan/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 web-ruslan/laravel-pretty-pagination
```

First register the service provider and facade in your application.

```
// config/app.php

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

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

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

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

use WebRuslan\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 paginator base url just use setPath function

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

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

```
php artisan vendor:publish --provider="WebRuslan\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)
```

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

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

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

```
/**
 * @param  \Illuminate\Contracts\Pagination\Paginator $paginator
 * @param int  $page
 * @param bool $full
 * @return string
 */
public function pageUrl(Paginator $paginator, $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  array $styles
 * @param  bool $additionalLinks
 * @return string
 */
public function renderPageList(LengthAwarePaginator $paginator, $full = false, $styles = null, $additionalLinks = false)
```

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

    1
    2
    3
    4
    &raquo;

```

You can add styles for paginator like this:

```
/**
 * Example : {!! PaginateRoute::renderPageList($companies, false,
 * [
 *    'ul' => 'pagination-list',
 *    'li' => 'pagination-list-item',
 *    'a' => 'pagination-list-link',
 *    'previous_a' => 'pagination-prev',
 *    'next_a' => 'pagination-next',
 *    'active_a' => 'pagination-active',
 *    'previous_label' => '',
 *    'next_label' => '',
 * ],
 * true) !!}
 */

        2

        3

        4

        4

```

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

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.7% 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.

###  Release Activity

Cadence

Every ~74 days

Recently: every ~0 days

Total

8

Last Release

1550d ago

PHP version history (2 changes)v1.1PHP ^7.1.3

v1.2PHP ^7.1.3|^8

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22293750?v=4)[Ruslan Rieznikov](/maintainers/web-ruslan)[@web-ruslan](https://github.com/web-ruslan)

---

Top Contributors

[![vipertecpro](https://avatars.githubusercontent.com/u/11619188?v=4)](https://github.com/vipertecpro "vipertecpro (23 commits)")[![web-ruslan](https://avatars.githubusercontent.com/u/22293750?v=4)](https://github.com/web-ruslan "web-ruslan (11 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

laravelpaginationlaravelpaginationroutingseolaravel-pretty-paginationweb-ruslan

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M117](/packages/nuwave-lighthouse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)

PHPackages © 2026

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