PHPackages                             laraish/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. [Framework](/categories/framework)
4. /
5. laraish/pagination

ActiveLibrary[Framework](/categories/framework)

laraish/pagination
==================

A simple library for generating pagination.

v4.0.0(9mo ago)05.2k4[1 PRs](https://github.com/laraish/pagination/pulls)2MITPHPPHP ^8.2

Since Nov 6Pushed 9mo ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (22)Used By (2)

This is a simple PHP library for creating pagination.

Basic Usage
===========

[](#basic-usage)

Here is an example for creating the pagination in WordPress.

```
global $wp_query;

// The total number of items
$total       = (int)$wp_query->found_posts;

// The number of items are going to be displayed per page.
$perPage     = (int)$wp_query->query_vars['posts_per_page'];

// The current page number.
$currentPage = (int)$wp_query->query_vars['paged'];

// additional options
$options     = ['urlStyle' => 'pretty'];

$paginator   = new Paginator($total, $perPage, $currentPage, $options);

echo $paginator->toHtml();
```

Customize the markup
--------------------

[](#customize-the-markup)

If you don't like the default markup, you can specify your own view file to output the markup.

```
$paginator = new Paginator($total, $perPage, $currentPage, ['view'=> '/www/var/example.com/pagination.php']);
```

You can also specify the view with using the dot notation, for example `['view'=> 'components.pagination']`; by using the dot notation it will try to use the [Blade Templates](https://laravel.com/docs/master/blade) if possible.

Take a look at the [preset views](https://github.com/laraish/pagination/tree/master/resources/views) for more details.

Options
=======

[](#options)

onEachSide
----------

[](#oneachside)

TypeDefaultint3The number of links on each side of the center link.

type
----

[](#type)

TypeDefaultstring'default'The rendering type.

- `default`
- `menu`
- `simple`

view
----

[](#view)

TypeDefaultstringnullThe path of view file.

Could be either a blade template or a regular php file.
If you wish to use a php file, you should add the `.php` at the end of the string.

urlStyle
--------

[](#urlstyle)

TypeDefaultstring'pretty'The link style.

- `pretty`: example.com/news/page/10
- `queryString`: example.com/news/?page=10

nextPageText
------------

[](#nextpagetext)

TypeDefaultstring'»'The next page link text.

prevPageText
------------

[](#prevpagetext)

TypeDefaultstring'«'The previous page link text.

path
----

[](#path)

TypeDefaultstringnullThe user-defined base path.

suffix
------

[](#suffix)

TypeDefaultstring''The suffix to be added to the very end of the url. Such as fragment or query-strings.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance58

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 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

Every ~160 days

Recently: every ~456 days

Total

21

Last Release

273d ago

Major Versions

v0.6.1 → v1.0.02020-08-17

v1.0.1 → v2.0.02020-09-28

v2.0.0 → v3.0.02023-12-05

v3.0.0 → v4.0.02025-08-17

PHP version history (6 changes)v0.1.0PHP &gt;=5.6.4

v0.2.0PHP &gt;=7.1.3

v0.3.3PHP ^7.2

v2.0.0PHP ^7.3

v3.0.0PHP ^8.1

v4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7e8cfe971551433df7557368a24c122907ebdc5c5fc8c18920f1438aaafbffd?d=identicon)[yaquawa](/maintainers/yaquawa)

---

Top Contributors

[![yaquawa](https://avatars.githubusercontent.com/u/13927101?v=4)](https://github.com/yaquawa "yaquawa (20 commits)")

---

Tags

frameworklaravelwordpress

### Embed Badge

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

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

###  Alternatives

[rebing/graphql-laravel

Laravel wrapper for PHP GraphQL

2.2k7.1M26](/packages/rebing-graphql-laravel)[laraish/options

Package for creating options page in WordPress.

105.2k2](/packages/laraish-options)[wpstarter/framework

The WpStarter Framework - Laravel Framework for WordPress

1810.1k4](/packages/wpstarter-framework)

PHPackages © 2026

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