PHPackages                             wnikk/smart-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. wnikk/smart-pagination

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

wnikk/smart-pagination
======================

Reverse pagination for Laravel with SEO-friendly links and stable URLs

1.18.13(9mo ago)136MITPHPPHP ^8.0

Since Aug 18Pushed 9mo agoCompare

[ Source](https://github.com/wnikk/smart-pagination)[ Packagist](https://packagist.org/packages/wnikk/smart-pagination)[ Docs](https://github.com/wnikk/smart-pagination)[ RSS](/packages/wnikk-smart-pagination/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Smart Pagination for Laravel
============================

[](#smart-pagination-for-laravel)

SmartPagination is a Laravel Blade component that simplifies pagination rendering and adds support for reverse pagination (descending page numbers). It’s designed to be flexible, SEO-friendly, and easy to customize.

Designed for blogs, news feeds, and any content that grows over time.

Features
--------

[](#features)

- Stable URLs — older content stays on the same page even as new items are added
- SEO-Friendly — search engines retain indexing without shifting links
- User-Centric — newest content always appears on the first page
- Blade component - easy to use in Blade templates with Bootstrap-ready markup
- Flexible Routing - supports custom URL patterns via `page-pattern`
- Preserves all other query parameters
- Reverse pagination support - show newest content first

---

🌐 SEO-Friendly Pagination with Custom URL Patterns
--------------------------------------------------

[](#-seo-friendly-pagination-with-custom-url-patterns)

SmartPagination allows you to generate clean, customizable, and SEO-optimized pagination URLs for your applications. Instead of relying on default query parameters like `?page=2`, you can define your own URL patterns such as `/blog/page-2`, `/news-p3.html`, or even `/archive-4y.html`.

### ✅ Why It Matters for SEO

[](#-why-it-matters-for-seo)

Search engines prefer stable, predictable URLs. When paginated content (like blog posts, product listings, or news articles) grows over time, traditional pagination can cause older content to shift across pages — which may lead to:

- Duplicate indexing
- Loss of link equity
- Lower rankings for older content

With **reverse pagination** and **custom URL patterns**, you can ensure that:

- The first page always shows the newest content
- Older content remains accessible at the same URL
- Search engines consistently index the same pages over time

This improves crawl efficiency and preserves ranking signals for evergreen content.

### 🔧 Examples of Custom Patterns

[](#-examples-of-custom-patterns)

You can define your own `pagePattern` using `{page}` as a placeholder:

PatternResulting URL (Page 2)`page-{page}``/blog/page-2``news-p{page}.html``/news/news-p2.html``archive-{page}y``/archive-2y`---

🔁 Reverse Pagination: Keep Your URLs Stable as Content Grows
------------------------------------------------------------

[](#-reverse-pagination-keep-your-urls-stable-as-content-grows)

Reverse pagination is a powerful feature that ensures your **newest content always appears on the first page**, while older content stays anchored to its original URLs. This is especially useful for blogs, news feeds, changelogs, or any time-sensitive content.

With **reverse pagination**, the first page always shows the latest items, and older pages remain unchanged — making your site more SEO-friendly.

### 🔧 Examples of Reverse Pagination

[](#-examples-of-reverse-pagination)

You have **100 articles**, sorted by newest first (`DESC`), showing **10 per page**.

#### 🔴 With Reverse Pagination Disabled

[](#-with-reverse-pagination-disabled)

Display PageReal PageArticles Shown`/news` (page 1)page 191–100 (newest)`/news/page-2`page 281–90.........`/news/page-10`page 101–10 (oldest)Tomorrow you publish 10 more articles (total: 110):

Display PageReal PageArticles Shown`/news` (page 1)page 1101–110 (newest)`/news/page-2`page 291–100.........`/news/page-11`page 111–10 (still oldest)#### ✅ With Reverse Pagination Enabled

[](#-with-reverse-pagination-enabled)

Display PageReal PageArticles Shown`/news` (page 10)page 191–100 (newest)`/news/page-9`page 281–90 always on page-9.........`/news/page-1`page 101–10 (oldest) always on page-1#### Result:

[](#result)

- New content appears on the first page
- Older content stays at the same URL
- Search engines retain stable indexing
- No shifting of articles across pages

---

Installation
------------

[](#installation)

Install via Composer:

```
composer require wnikk/smart-pagination
```

Usage
-----

[](#usage)

For basic usage, you can use the `smartPaginate` method on your Eloquent model. This method will automatically handle pagination with the latest items first and generate reverse pagination links.

For example, if you have a `Post` model and want to paginate the latest posts on controller:

```
$posts = \App\Models\Post::orderByDesc('created_at')->smartPaginate(10, reverse: true);
$posts->withPath('/post', '/page-{page}.html');
```

In your Blade view (by default):

```
By default:
{{ $posts->links() }}
```

Or your Blade custom view full version of params (SEO-friendly):

```

```

Publish Configuration (optional)
--------------------------------

[](#publish-configuration-optional)

Publish Configuration

```
php artisan vendor:publish --tag=smart-pagination-config
```

Publish Blade Views

```
php artisan vendor:publish --tag=smart-pagination-views
```

License
-------

[](#license)

MIT

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance58

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

274d ago

### Community

Maintainers

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

---

Top Contributors

[![wnikk](https://avatars.githubusercontent.com/u/119752633?v=4)](https://github.com/wnikk "wnikk (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wnikk-smart-pagination/health.svg)

```
[![Health](https://phpackages.com/badges/wnikk-smart-pagination/health.svg)](https://phpackages.com/packages/wnikk-smart-pagination)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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